Skip to main content

Make the log system easier to use

Project description

Aim

Make the log system easier to use, by simply:

import log

log.info("Hello handy-log!")

Features

  • While the builtin logging.info(msg) uses the root logger to record message, log.info(msg) can use current module's logger. Here, current module means the module inside which you invoked the log.info(msg). You don't have to code like this any more:
    import logging
    
    logger = logging.getLogger(you_package_name)
    
    logger.info(your_msg)
    
  • A bunch of predefined formats, handlers, loggers.
  • Easy to config, and easy to invoke.

Mechanism

  1. This is a wrapper for python builtin logging system.
  2. Load yaml to dict, then use the logging.config.dictConfig(config_dict) to configure the logging system.
  3. When you invoke log.info(msg), handy-log will first find current module's logger, and then use this logger to log the message.

Configuration/How to use

  • Option 1:
    Do nothing, use the default configuration. Just import log and use it.
  • Option 2:
    1. Create your own handy-log.yaml in your current work directory.
    2. Then just import log and use it.
  • Option 3:
    1. Create your own yaml configuration file.

    2. Invoke log.init(your_config_file) to configure the logger.

      This will merge your_config_file's content with the builtin handy-log.yaml first, then apply the merged configuration to the builtin logging system.

    3. Then import log and use it.

Notes:

  • Since the root logger can only be initialized once, you should invoke log.init() before any other logger configuration takes effect.
  • In the configuration file, loggers and handlers have their independent logging level, The message needs to pass through all these level to be recorded.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

handy-log-2022.5.5a2.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

handy_log-2022.5.5a2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file handy-log-2022.5.5a2.tar.gz.

File metadata

  • Download URL: handy-log-2022.5.5a2.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for handy-log-2022.5.5a2.tar.gz
Algorithm Hash digest
SHA256 f0b95dd46cced188716d58534ea78a90431a75928ab049a2cdf847afe29bc7de
MD5 d7fbad218682d3a9581c3320ffa95604
BLAKE2b-256 30ddf0172539b7c430094a9ef6b4454b62a501bea42b3f0d322d9d249fc287da

See more details on using hashes here.

File details

Details for the file handy_log-2022.5.5a2-py3-none-any.whl.

File metadata

  • Download URL: handy_log-2022.5.5a2-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for handy_log-2022.5.5a2-py3-none-any.whl
Algorithm Hash digest
SHA256 83cbb3485a1a17adf6eae6921a419b791d721ad557201662561b46b8a2be7c9b
MD5 9cb4558362c748e7ce63a153d3492ca0
BLAKE2b-256 c2becc8e836f5d8ce078dbf3409c14dc8a8c2f34e0e34728c138f4a43b29023a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page