def __init__(self, context, id_name, config):
     self.id_name = id_name
     self.context = context
     apiLoggerInit.loggerInit()
     self.frontend = self.context.socket(zmq.ROUTER)
     self.config = config
     self.mongo_client = log_mongo.LogMongo(self.config)
Beispiel #2
0
def main():
    """
    Simply send strings of logs to the logCollector.
    """

    # =========================
    # Standard initialization
    # =========================
    apiLoggerInit.loggerInit()
    client = LoggingClientClass(platform.node())
    if client is None:
        sys.stderr.write('Cannot create LoggingClientClass!\n')
        sys.exit(1)
    client.start()

    # All the log levels in the remote logger
    REMOTE_LOG_LEVELS = {
        'DEBUG': client.debug,
        'CMD': client.cmd,
        'INFO': client.info,
        'WARNING': client.warning,
        'ERROR': client.error,
        'CRITICAL': client.critical
    }

    info_msg = 'status=1,msg=info,reason=nothing important'
    warning_msg = 'msg=Warning,a=n,stuff=yuck,floor=ceiling'
    error_msg = 'status=3,warn=continue,babble=yes,reason=testing'
    debug_msg = 'msg=debug,details=yes'
    critical_msg = 'msg=critical,reason=meltdown'

    # Do NOT change the messages below.
    # When run with the unit test code.  the unit test code checks for these
    # messages to exist in the log files after logging.
    for key, fcn in REMOTE_LOG_LEVELS.items():
        fcn('thru=%s,level=%s,using=REMOTE_LOG_LEVELS' % (key, key))

    client.warning('type=client,' + warning_msg)
    client.error('type=client,' + error_msg)
    client.debug('type=client,' + debug_msg)
    client.critical('type=client,' + critical_msg)
    client.info('type=client,' + info_msg)

    client.info('type=logging,Does logging.info(), etc. still work?')
    client.warning('type=logging,Once again - using pure logging.')
    client.warning(
        'type=logging,Notice no "host=..." on tagged onto the logs.')

    client.warning('type=logging,' + warning_msg)
    client.error('type=logging,' + error_msg)
    client.debug('type=logging,' + debug_msg)
    client.critical('type=logging,' + critical_msg)
    client.info('type=logging,' + info_msg)

    client.debug('debugging? Sending to logCollector?')
    client.info('loggingClientTask: Done')
def main():
    """
    Simply send strings of logs to the logCollector.
    """

    # =========================
    # Standard initialization
    # =========================
    apiLoggerInit.loggerInit()
    client = LoggingClientClass(platform.node())
    if client is None:
        sys.stderr.write('Cannot create LoggingClientClass!\n')
        sys.exit(1)
    client.start()

    # All the log levels in the remote logger
    REMOTE_LOG_LEVELS = {
        'DEBUG': client.debug,
        'CMD': client.cmd,
        'INFO': client.info,
        'WARNING': client.warning,
        'ERROR': client.error,
        'CRITICAL': client.critical}

    info_msg = 'status=1,msg=info,reason=nothing important'
    warning_msg = 'msg=Warning,a=n,stuff=yuck,floor=ceiling'
    error_msg = 'status=3,warn=continue,babble=yes,reason=testing'
    debug_msg = 'msg=debug,details=yes'
    critical_msg = 'msg=critical,reason=meltdown'

    # Do NOT change the messages below.
    # When run with the unit test code.  the unit test code checks for these
    # messages to exist in the log files after logging.
    for key, fcn in REMOTE_LOG_LEVELS.items():
        fcn('thru=%s,level=%s,using=REMOTE_LOG_LEVELS' % (key, key))

    client.warning('type=client,' + warning_msg)
    client.error('type=client,' + error_msg)
    client.debug('type=client,' + debug_msg)
    client.critical('type=client,' + critical_msg)
    client.info('type=client,' + info_msg)

    client.info('type=logging,Does logging.info(), etc. still work?')
    client.warning('type=logging,Once again - using pure logging.')
    client.warning('type=logging,Notice no "host=..." on tagged onto the logs.')

    client.warning('type=logging,' + warning_msg)
    client.error('type=logging,' + error_msg)
    client.debug('type=logging,' + debug_msg)
    client.critical('type=logging,' + critical_msg)
    client.info('type=logging,' + info_msg)

    client.debug('debugging? Sending to logCollector?')
    client.info('loggingClientTask: Done')
Beispiel #4
0
    def logCollectorSetup(self):
        """Perform operations to start logging."""
        global loggingClient

        apiLoggerInit.loggerInit()
        loggingClient = loggingClientTask.LoggingClientClass(platform.node())
        if loggingClient is None:
            sys.stderr.write('Cannot create LoggingClientClass!\n')
            sys.exit(1)
        loggingClient.start()
        loggingClient.info('app=dirClient,status=started-inited')
        return loggingClient
    def logCollectorSetup(self):
        """Perform operations to start logging."""
        global loggingClient

        apiLoggerInit.loggerInit()
        loggingClient = loggingClientTask.LoggingClientClass(platform.node())
        if loggingClient is None:
            sys.stderr.write('Cannot create LoggingClientClass!\n')
            sys.exit(1)
        loggingClient.start()
        loggingClient.info('app=dirClient,status=started-inited')
        return loggingClient
Beispiel #6
0
    def __init__(self, id_name=platform.node()):
        """
        id_name = These names appear in
                the log entry as an indentifier of the source
                of the log entry.
        """

        self.context = None
        self.id_name = str(id_name)
        self.socket = None
        self.poll = None
        self.reqs = 0  # Count of messages
        logging.basicConfig(level=logging.NOTSET)  # Log everything
        apiLoggerInit.loggerInit()
        threading.Thread.__init__(self)
    def __init__(self, id_name=platform.node()):
        """
        id_name = These names appear in
                the log entry as an indentifier of the source
                of the log entry.
        """

        self.context = None
        self.id_name = str(id_name)
        self.socket = None
        self.poll = None
        self.reqs = 0       # Count of messages
        logging.basicConfig(level=logging.NOTSET)   # Log everything
        apiLoggerInit.loggerInit()
        threading.Thread.__init__(self)
 def __init__(self, context, id_name):
     self.id_name = id_name
     self.context = context
     apiLoggerInit.loggerInit()
     self.frontend = self.context.socket(zmq.ROUTER)
 def __init__(self, context, id_name):
     self.id_name = id_name
     self.context = context
     apiLoggerInit.loggerInit()
     self.frontend = self.context.socket(zmq.ROUTER)