Skip to main content

This package provides sample loggers.

Project description

Deep Learning Tools for Pytorch

Python >= 3.8

This package provides some common configurations to quickly create your own logger through the logging library.

Installation

pip install sample_loggers

Example for using

To ues the logger directly, you can use the logger object provided by the package.

import os
from sample_loggers import logger

# you can set the log dir and log file name through environment variables.
os.environ["LOG_DIR"] = "./output/log"
os.environ["LOG_FILE_NAME"] = "log.txt"

logger.info("hello world")

To define your own logger, you can use the create_logger method. This method allows you to specify the name of the logger and the log level.

from sample_loggers import create_logger, LEVEL

# The format can be defined as a string, 
# you can refer to the official website 
# https://docs.python.org/3/library/logging.html#logrecord-attributes.
define_format = "Define your own format here, you can use the default format or define your own format."

logger = create_logger(
    logger_name="logger",
    log_level=LEVEL.INFO,
    log_file_name="log.txt",
    output_dir="./output/log",
    format_type="default",
    define_format=define_format
)

Update

  • 0.0.5 - improve the default logger.
  • 0.0.4post1 - Fix the bug.
  • 0.0.4 - Samplify thr method to create logger and provide the default logger that can be used directly.
  • 0.0.3post1 - Fix the bug.
  • 0.0.3 - Add the level definition.
  • 0.0.2post2 - Fix the bug.
  • 0.0.2post1 - Fix the bug.
  • 0.0.2 - Add the summery and throughput method.
  • 0.0.1 - We provide the common config for logging to create logger.

License

Sample Loggers is MIT licensed. See the LICENSE for details.

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

sample_loggers-0.0.5.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

sample_loggers-0.0.5-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file sample_loggers-0.0.5.tar.gz.

File metadata

  • Download URL: sample_loggers-0.0.5.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for sample_loggers-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7a47a0f9a9a829856ea85f09bce8de496109c6223f502421d5a8194913aa372e
MD5 03e3bc82fa95445d0a710407854e9ddd
BLAKE2b-256 4ed32ec1e9fe826b20ce47f8f6812a280fe4a04d0496e92b58d0320f4803d8b5

See more details on using hashes here.

File details

Details for the file sample_loggers-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: sample_loggers-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for sample_loggers-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dc3b51e8fb3c6ba5c8c5879c84c1c56208ef140326e92199a6dd08244cc11813
MD5 109b336ce4030c404afeb12e3c863bd4
BLAKE2b-256 4ce889d44753f2eb87204e4387180659281fb8760c958505578d3e4d6f1b0e20

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