pydoit_nb.doit_tools#

Tools for compatibility with [doit](pydoit.org)

setup_logging#

setup_logging(stdout_level=30, log_file='dodo.log', file_level=10, log_fmt='%(levelname)s - %(asctime)s %(name)s %(processName)s (%(module)s:%(funcName)s:%(lineno)d):  %(message)s', datefmt='%Y-%m-%d %H:%M:%S')[source]#

Set up logging

This is a conveniance function. It does things like adding handlers to the root logger, which won’t always be helpful or desired so use with some care. It will not cover all possible logging use cases. If you have a more complicated use case, you will probably need to write your own set up implementation. However, this implementation may be of some use.

Parameters:
  • stdout_level (int) – Level to use for logging to stdout

  • log_file (typing.Optional[str]) – File to write on disk logs to

  • file_level (int) – Level to use for logging to file

  • log_fmt (str) – Format to use for log strings

  • datefmt (str) – Format to use for dates

Returns:

logging.Logger – dodo logger

swallow_output#

swallow_output(func)[source]#

Decorate function so the output is swallowed

This is needed to make pydoit recognise the task has run correctly

Parameters:

func (collections.abc.Callable[..., typing.Any]) – Function to decorate

Returns:

collections.abc.Callable[..., None] – Decorated function