How to use the logzero.loglevel 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 / 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 lyakaap / pytorch-template / src / utils.py View on Github external
def get_logger(log_dir, loglevel=logging.INFO, tensorboard_dir=None):
    from logzero import logger

    if not Path(log_dir).exists():
        Path(log_dir).mkdir(parents=True)
    logzero.loglevel(loglevel)
    logzero.logfile(log_dir + '/logfile')

    if tensorboard_dir is not None:
        if not Path(tensorboard_dir).exists():
            Path(tensorboard_dir).mkdir(parents=True)
        writer = SummaryWriter(tensorboard_dir)

        return logger, writer

    return logger
github openatx / uiautomator2 / uiautomator2 / cli / runyaml.py View on Github external
def main(filename, debug=False, onlystep=False):
    if not debug:
        logzero.loglevel(logging.INFO)

    import yaml
    with open(filename, 'rb') as f:
        cnf = yaml.load(f)
        if onlystep:
            cnf['launch'] = False
        tc = JSONRunner(cnf)
        tc.run()
github wylok / sparrow / module / loging.py View on Github external
def write(Message,*v,**d):
    logzero.logfile(log_path)
    logzero.loglevel(logging.INFO)
    logger.info(str(Message))
    if v:
        for msg in v:
            logger.info('%s\n' %msg)
    if d:
        for k in d:
            logger.info('%s\n' %d[k])
github kpj / Vydia / vydia / core / controller.py View on Github external
def _setup_logging(self) -> None:
        # init logzero
        logzero.loglevel(logging.WARNING)
        logzero.logfile(
            self.model.LOG_FILE,
            maxBytes=1e6, backupCount=3)

        # enforce logging of unhandled exceptions
        def handle_exception(exc_type, exc_value, exc_traceback):
            logger.error(
                'Uncaught exception',
                exc_info=(exc_type, exc_value, exc_traceback))
        sys.excepthook = handle_exception
github SumoLogic / sumologic-content / sumologictoolbox / sumotoolbox.py View on Github external
from modules.content import content_tab
from modules.collector import collector_tab

#local imports
from modules.sumologic import SumoLogic
from modules.credentials import CredentialsDB
from modules.dialogs import *

# detect if in Pyinstaller package and build appropriate base directory path
if getattr(sys, 'frozen', False):
    basedir = sys._MEIPASS
else:
    basedir = os.path.dirname(os.path.abspath(__file__))
# Setup logging
logzero.logfile("sumotoolbox.log")
logzero.loglevel(level=20)  #  Info Logging
# Log messages
logger.info("SumoLogicToolBox started.")
# This script uses Qt Designer files to define the UI elements which must be loaded
qtMainWindowUI = os.path.join(basedir, 'data/sumotoolbox.ui')
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtMainWindowUI)

class sumotoolbox(QtWidgets.QMainWindow, Ui_MainWindow):



    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        # detect if we are running in a pyinstaller bundle and set the base directory for file loads"
        if getattr(sys, 'frozen', False):
            self.basedir = sys._MEIPASS
github joeyac / crazyWx / config.py View on Github external
INFO_STRING = INFO_STRING.format(end=TRAINING_END_STRING)

API_KEY = 'b2195ca4d67841ff8ca74ce1aada9860'

# None for no status, exist for 'reminded'
# REMINDED_FILE_PATH = os.path.join(os.getcwd(), 'reminded.json')
# None for no status, 0 for message mode, 1 for robot mode
STATUS_FILE_PATH = os.path.join(os.getcwd(), 'status.json')


# 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)
github voltaire321 / sumologictoolbox / sumotoolbox.py View on Github external
def change_logging_level(self):
        level = self.loggingmenugroup.checkedAction()
        if level.text() == "Informational":
            logzero.loglevel(level=20)
        elif level.text() == "Debug":
            logzero.loglevel(level=10)