def loggingInit(level = logging.INFO): """ Initialize logging """ logger = logging.getLogger() logger.setLevel(level) appName = "branlygw" if sys.platform == "darwin": subSystem = "dev" else: # Assume raspberry Pi subSystem = "prod" # Log to remote remotelogger.init(logger = logger, appName = appName, subSystem = subSystem, level = level, host = "midi.local") if 0: # Log to branlygw.log fileFormatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") logfile = logging.handlers.RotatingFileHandler("branlygw.log") logfile.setLevel(logging.INFO) logfile.setFormatter(fileFormatter) logger.addHandler(logfile) # Log to stdout ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch)
def loggingInit(level): log = logging.getLogger(__name__) # Initialize remote logging logger = logging.getLogger() logger.setLevel(level) remotelogger.init(logger = logger, appName = "airlinecol", subSystem = None, host = "midi.local", level = logging.DEBUG) if 1: # Log to stdout ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch)
def loggingInit(level, log_host): log = logging.getLogger(__name__) # Initialize remote logging logger = logging.getLogger() logger.setLevel(level) if log_host != None: remotelogger.init(logger = logger, appName = "radarprox", subSystem = None, host = log_host, level = level) # Log to stdout ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch)
def loggingInit(level): global args log = logging.getLogger(__name__) # Initialize remote logging logger = logging.getLogger() logger.setLevel(level) if args.rlog_host: remotelogger.init(logger = logger, appName = "radarprox", subSystem = None, host = args.rlog_host, level = level) # Log to stdout ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch)
def loggingInit(level): log = logging.getLogger(__name__) # Initialize remote logging logger = logging.getLogger() logger.setLevel(level) remotelogger.init(logger=logger, appName="adsbclient", subSystem=None, host="midi.local", level=logging.DEBUG) if 1: # Log to stdout ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch)
def loggingInit(level=logging.INFO): """ Initialize logging """ logger = logging.getLogger() logger.setLevel(level) appName = "branlygw" if sys.platform == "darwin": subSystem = "dev" else: # Assume raspberry Pi subSystem = "prod" # Log to remote remotelogger.init(logger=logger, appName=appName, subSystem=subSystem, level=level, host="midi.local") if 0: # Log to branlygw.log fileFormatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s") logfile = logging.handlers.RotatingFileHandler("branlygw.log") logfile.setLevel(logging.INFO) logfile.setFormatter(fileFormatter) logger.addHandler(logfile) # Log to stdout ch = logging.StreamHandler(sys.stdout) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch)