Fixed build, strated adding fluent support
diff --git a/BUILD.md b/BUILD.md
index 5c38717..1bb4537 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -66,7 +66,7 @@
 1. Missing virtualenv binary. Resolution: install virtualenv.
 
    ```
-   brew install pyenv-virtualenv
+   brew install python pip virtualenv
    ```
 
 1. 'make venv' exits with error 'openssl/opensslv.h': file not found.
diff --git a/voltha/main.py b/voltha/main.py
index 7c6c745..7c2aacf 100755
--- a/voltha/main.py
+++ b/voltha/main.py
@@ -15,20 +15,17 @@
 # limitations under the License.
 #
 
-""" virtual OLT Hardware Abstraction """
+"""Virtual OLT Hardware Abstraction main entry point"""
 
 import argparse
-import logging
-import sys
-import structlog
+
+from structlog_setup import setup_logging, DEFAULT_FLUENT_SERVER
 
 
 def parse_args():
 
     parser = argparse.ArgumentParser()
 
-    parser.add_argument('-i', '--interface', dest='interface', action='store', default='eth0',
-                        help='ETH interface to send (default: eth0)')
     parser.add_argument('--no-banner', dest='no_banner', action='store_true', default=False,
                         help='omit startup banner log lines')
     parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False,
@@ -36,38 +33,20 @@
     parser.add_argument('-q', '--quiet', dest='quiet', action='store_true', default=False,
                         help="suppress debug and info logs")
 
+    # fluentd logging related options
+    parser.add_argument('--enable-fluent', dest='enable_fluent', action='store_true', default=False,
+                        help='enable log stream emission to fluent(d) agent')
+    parser.add_argument('--fluent-server', dest='fluent_server', action='store', default=DEFAULT_FLUENT_SERVER,
+                        # variable='<fluent-host>:<fluent-port>',
+                        help="<fluent-host>:<fluent-port>: host name (or ip address) and tcp port of fluent agent")
+
+    # placeholder
+    parser.add_argument('-i', '--interface', dest='interface', action='store', default='eth0',
+                        help='ETH interface to send (default: eth0)')
+
     return parser.parse_args()
 
 
-def setup_logging(args):
-    """
-    Set up logging such that:
-    - The primary logging entry method is structlog (see http://structlog.readthedocs.io/en/stable/index.html)
-    - By default, the logging backend is Python standard lib logger
-    - In the future, fluentd or other backends will be supported too
-    """
-
-    # Configure standard logging
-    DATEFMT = '%Y-%m-%dT%H:%M:%S'
-    FORMAT = '%(asctime)-15s.%(msecs)03d %(levelname)-8s %(msg)s'
-    level = logging.DEBUG if args.verbose else (logging.WARN if args.quiet else logging.INFO)
-    logging.basicConfig(stream=sys.stdout, level=level, format=FORMAT, datefmt=DATEFMT)
-
-    # Hook up structlog to standard logging
-    processors = [
-        structlog.processors.StackInfoRenderer(),
-        structlog.processors.format_exc_info,
-        structlog.processors.KeyValueRenderer(),  # structlog.processorsJSONRenderer(),
-
-    ]
-    structlog.configure(logger_factory=structlog.stdlib.LoggerFactory(), processors=processors)
-
-    # Mark first line of log
-    log = structlog.get_logger()
-    log.info("first-line")
-    return log
-
-
 def print_banner(args, log):
     log.info(' _    ______  __  ________  _____ ')
     log.info('| |  / / __ \/ / /_  __/ / / /   |')
diff --git a/voltha/structlog_setup.py b/voltha/structlog_setup.py
new file mode 100644
index 0000000..eda4004
--- /dev/null
+++ b/voltha/structlog_setup.py
@@ -0,0 +1,112 @@
+#
+# Copyright 2016 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""Setting up proper logging for Voltha"""
+
+import logging
+import structlog
+import sys
+
+from fluent import sender
+from structlog import _frames
+
+
+DEFAULT_FLUENT_SERVER = 'localhost:24224'
+
+
+'''
+class FluentLoggerFactory(object):
+
+    def __init__(self, tag, server=DEFAULT_FLUENT_SERVER, additional_ignores=None):
+        self.host = server.split(':')[0]
+        self.port = int(server.split(':')[1])
+        self.emitter = sender.FluentSender(tag=tag, host=self.host, port=self.port)
+        self._ignore = additional_ignores
+
+    def __call__(self, name=None):
+        if name is not None:
+            return logging.getLogger(name)
+        else:
+            _, name = _frames._find_first_app_frame_and_name(self._ignore)
+            return logging.getLogger(name)
+'''
+
+
+class FluentRenderer(object):
+    def __call__(self, logger, name, event_dict):
+        args = ()
+        kwargs = event_dict
+        return args, kwargs
+
+
+def setup_fluent_logging(args):
+    """Setup structlog pipeline and hook it into the fluent sender"""
+
+    # Configure standard logging
+    DATEFMT = '%Y%m%dT%H%M%S'
+    FORMAT = '%(asctime)-11s.%(msecs)03d %(levelname)-8s %(msg)s'
+    level = logging.DEBUG if args.verbose else (logging.WARN if args.quiet else logging.INFO)
+    logging.basicConfig(stream=sys.stdout, level=level, format=FORMAT, datefmt=DATEFMT)
+
+    processors = [
+        structlog.processors.StackInfoRenderer(),
+        structlog.processors.format_exc_info,
+        FluentRenderer()
+        #structlog.processors.KeyValueRenderer(),  # structlog.processorsJSONRenderer(),
+    ]
+    # structlog.configure(logger_factory=FluentLoggerFactory(args.fluent_server),
+    #                     processors=processors)
+    structlog.configure(logger_factory=structlog.stdlib.LoggerFactory(),
+                        processors=processors)
+
+
+def setup_standard_logging(args):
+    """Setup structlog pipeline and hook it into the standard logging framework of Python"""
+
+    # Configure standard logging
+    DATEFMT = '%Y%m%dT%H%M%S'
+    FORMAT = '%(asctime)-11s.%(msecs)03d %(levelname)-8s %(msg)s'
+    level = logging.DEBUG if args.verbose else (logging.WARN if args.quiet else logging.INFO)
+    logging.basicConfig(stream=sys.stdout, level=level, format=FORMAT, datefmt=DATEFMT)
+
+    # Hook up structlog to standard logging
+    processors = [
+        structlog.processors.StackInfoRenderer(),
+        structlog.processors.format_exc_info,
+        structlog.processors.KeyValueRenderer(),  # structlog.processorsJSONRenderer(),
+
+    ]
+    structlog.configure(logger_factory=structlog.stdlib.LoggerFactory(), processors=processors)
+
+
+def setup_logging(args):
+    """
+    Set up logging such that:
+    - The primary logging entry method is structlog (see http://structlog.readthedocs.io/en/stable/index.html)
+    - By default, the logging backend is Python standard lib logger
+    - Alternatively, fluentd can be configured with to be the backend, providing direct
+      bridge to a fluent logging agent.
+    """
+
+    if args.enable_fluent:
+        setup_fluent_logging(args)
+    else:
+        setup_standard_logging(args)
+
+    # Mark first line of log
+    log = structlog.get_logger()
+    log.info("first-line")
+    return log