How to use the logmuse.init_logger function in logmuse

To help you get started, we’ve selected a few logmuse 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 databio / pypiper / pypiper / manager.py View on Github external
self.cores = params['cores']
        self.output_parent = params['output_parent']
        self.testmode = params['testmode']


        # Set up logger
        logger_kwargs = logger_kwargs or {}
        default_logname = ".".join([__name__, self.__class__.__name__, self.name])
        if not args:
            # strict is only for logger_via_cli.
            kwds = {k: v for k, v in logger_kwargs.items() if k != "strict"}
            try:
                name = kwds.pop("name")
            except KeyError:
                name = default_logname
            self._logger = logmuse.init_logger(name, **kwds)
            self.debug("Logger set with logmuse.init_logger")
        else:
            logger_kwargs.setdefault("name", default_logname)
            try:
                self._logger = logmuse.logger_via_cli(args)
                self.debug("Logger set with logmuse.logger_via_cli")
            except logmuse.est.AbsentOptionException:
                self._logger = logmuse.init_logger("pypiper", level="DEBUG")
                self.debug("logger_via_cli failed; Logger set with logmuse.init_logger")

        # Keep track of an ID for the number of processes attempted
        self.proc_count = 0

        # We use this memory to pass a memory limit to processes like java that
        # can take a memory limit, so they don't get killed by a SLURM (or other
        # cluster manager) overage. However, with java, the -Xmx argument can only
github databio / refgenie / refgenie / __init__.py View on Github external
from ._version import __version__
import logmuse
logmuse.init_logger("refgenie")
github databio / pypiper / pypiper / manager.py View on Github external
if not args:
            # strict is only for logger_via_cli.
            kwds = {k: v for k, v in logger_kwargs.items() if k != "strict"}
            try:
                name = kwds.pop("name")
            except KeyError:
                name = default_logname
            self._logger = logmuse.init_logger(name, **kwds)
            self.debug("Logger set with logmuse.init_logger")
        else:
            logger_kwargs.setdefault("name", default_logname)
            try:
                self._logger = logmuse.logger_via_cli(args)
                self.debug("Logger set with logmuse.logger_via_cli")
            except logmuse.est.AbsentOptionException:
                self._logger = logmuse.init_logger("pypiper", level="DEBUG")
                self.debug("logger_via_cli failed; Logger set with logmuse.init_logger")

        # Keep track of an ID for the number of processes attempted
        self.proc_count = 0

        # We use this memory to pass a memory limit to processes like java that
        # can take a memory limit, so they don't get killed by a SLURM (or other
        # cluster manager) overage. However, with java, the -Xmx argument can only
        # limit the *heap* space, not total memory use; so occasionally SLURM will
        # still kill these processes because total memory goes over the limit.
        # As a kind of hack, we'll set the java processes heap limit to 95% of the
        # total memory limit provided.
        # This will give a little breathing room for non-heap java memory use.

        if not params['mem'].endswith(('K','M','G','T')):
            self.mem = params['mem'] + "M"

logmuse

Logging setup

BSD-2-Clause
Latest version published 9 months ago

Package Health Score

53 / 100
Full package analysis

Similar packages