Examples

The two files below illustrate a basic use case for yalow. They can be found in the examples directory of the yalow github repository for further reference.

logalog.py

from pathlib import Path
from yalow import Yalow
from examples.example_package import super_mega_ukulele


if __name__ == '__main__':
    I_AM_GROOT = Path(__file__).parent.parent

    logger = Yalow(root_path=I_AM_GROOT, project_name='logalog').logger

    logger.info(f'IT\'S ALIVE!!!!!')
    super_mega_ukulele()

examples.example_package

import logging

module_logger = logging.getLogger('logalog.example_package')


def super_mega_ukulele():
    module_logger.error(f'And its minion is HUGE!')

Here’s the output that’s generated by the code above:

root_path/log/logalog.log

2020-03-11 16:43:38,507 - logalog - INFO: Logging initialized for project: logalog
2020-03-11 16:43:38,508 - logalog - INFO: IT'S ALIVE!!!!!
2020-03-11 16:43:38,508 - logalog.example_package - ERROR: And its minion is HUGE!