How to use the logzero.formatter function in logzero

To help you get started, we’ve selected a few logzero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jerrylizilong / autotest_platform / app / log.py View on Github external
def __init__(self) :
        self.logfile = os.path.join(config.logPath, 'flask.log')
        logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
        import logging
        formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');
        logzero.formatter(formatter)
        logzero.loglevel(logging.ERROR)
        self.logger = logzero.logger
github jerrylizilong / autotest_platform / app / core / log.py View on Github external
def __init__(self) :
        self.logfile = os.path.join(config.logPath, 'core-service.log')
        logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
        import logging
        formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');
        logzero.formatter(formatter)
        logzero.loglevel(logging.INFO)
        self.logger = logzero.logger
github jerrylizilong / autotest_platform / app / core / log1.py View on Github external
def __init__(self) :
        self.logfile = os.path.join(config.logPath, 'service.log')
        logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
        import logging
        formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');
        logzero.formatter(formatter)
        self.logger = logzero.logger
github joeyac / crazyWx / config.py View on Github external
# path where received image, file ... saved to
DATA_PATH = os.path.join(os.getcwd(), 'data')

if DEBUG:
    logzero.loglevel(logging.DEBUG)
else:
    logzero.loglevel(logging.WARNING)


fmt = '%(color)s[%(asctime)s <%(module)s:%(funcName)s>:%(lineno)d] [%(levelname)s]%(end_color)s - %(message)s'
formatter = logzero.LogFormatter(color=True, datefmt='%Y%m%d %H:%M:%S', fmt=fmt)
file_formatter = logzero.LogFormatter(color=False, datefmt='%Y%m%d %H:%M:%S', fmt=fmt)

logzero.formatter(formatter)

logzero.logfile(filename='crazyWx.log', formatter=file_formatter,
                maxBytes=1000000, backupCount=3)

# logzero.logfile(filename='warning.log', formatter=file_formatter,
#                 maxBytes=1000000, backupCount=3, loglevel=logging.WARNING)


logzero.logger.debug("crazyWx init")


if __name__ == '__main__':
    pass
    # import time
github trinity-project / trinity-eth / ethNode / scripts / store_erc20_tx.py View on Github external
import binascii
from decimal import Decimal
import time
import pymysql
import requests

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Numeric,Boolean,create_engine
from sqlalchemy.orm import sessionmaker
from config import setting
from logzero import logger,logfile
import logging
import logzero

formatter=logging.Formatter('%(asctime)-15s - %(levelname)s: %(message)s')
logzero.formatter(formatter)

pymysql.install_as_MySQLdb()
engine = create_engine('mysql://%s:%s@%s/%s' %(setting.MYSQLDATABASE["user"],
                                               setting.MYSQLDATABASE["passwd"],
                                               setting.MYSQLDATABASE["host"],
                                               setting.MYSQLDATABASE["db"]),
                       )
Session = sessionmaker(bind=engine)
Base = declarative_base()
# session=Session()

class Erc20Tx(Base):
    __tablename__ = 'erc20_tx'
    id = Column(Integer, primary_key=True)
    tx_id = Column(String(256),unique=True)
    block_number = Column(Integer)