Skip to main content

simple logging

Project description

logger_aux (v0.0.4)

DESCRIPTION_SHORT

simple logging

DESCRIPTION_LONG

designed for DRY simple/easy usage logging

Features

  1. keep all mostly used code in hidden class

License

See the LICENSE file for license rights and limitations (MIT).

Release history

See the HISTORY.md file for release history.

Installation

pip install logger-aux

Import

from logger_aux import *

USAGE EXAMPLES

See tests and sourcecode for other examples.


1. example1.py

from logger_aux import *
from object_info import ObjectInfo


# USAGE-1=DIRECT ===================================
logger0 = Logger()
# ObjectInfo(logger0.LOGGER).print()

# logger0.LOGGER.debug()    # TypeError: Logger.debug() missing 1 required positional argument: 'msg'
logger0.LOGGER.debug(None)  # OK
logger0.LOGGER.debug(True)  # OK
logger0.LOGGER.debug("")    # OK
logger0.LOGGER.debug("hello0-1")

logger1 = Logger("logger_first")
logger1.LOGGER.debug("hello1-1")

logger2 = Logger("logger_second")
logger2.LOGGER.debug("hello2-1")

logger0.LOGGER.debug("hello0-2")
logger1.LOGGER.debug("hello1-2")
logger2.LOGGER.debug("hello2-2")

# LOG_DIRPATH -----------------------
logger_dir = Logger("logger_dir", "c:\\1")
logger_dir.LOGGER.debug("hello_dir")

print(f"{logger_dir.LOG_DIRPATH=}")
print(f"{logger_dir.LOG_FILEPATH=}")


# USAGE-2=NESTING ===================================
class Example(Logger):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    def meth(self):
        self.LOGGER.debug("hello123")


Example().meth()

# ObjectInfo(logger0.LOGGER).print()

2. logger__Example.log

2024-04-26 12:12:34,977[DEBUG]Example(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,977[DEBUG]Example(main.py).__init__(line148)/thread21536::[Logger.Example] start STREAM
2024-04-26 12:12:34,977[DEBUG]Example(main.py).__init__(line151)/thread21536::[Logger.Example] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__Example.log]
2024-04-26 12:12:34,977[DEBUG]Example(example1.py).meth(line39)/thread21536::hello123

3. logger__logger_first.log

2024-04-26 12:12:34,970[DEBUG]logger_first(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,970[DEBUG]logger_first(main.py).__init__(line148)/thread21536::[Logger.logger_first] start STREAM
2024-04-26 12:12:34,971[DEBUG]logger_first(main.py).__init__(line151)/thread21536::[Logger.logger_first] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__logger_first.log]
2024-04-26 12:12:34,971[DEBUG]logger_first(example1.py).<module>(line16)/thread21536::hello1-1
2024-04-26 12:12:34,974[DEBUG]logger_first(example1.py).<module>(line22)/thread21536::hello1-2

4. logger__logger_second.log

2024-04-26 12:12:34,972[DEBUG]logger_second(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,973[DEBUG]logger_second(main.py).__init__(line148)/thread21536::[Logger.logger_second] start STREAM
2024-04-26 12:12:34,973[DEBUG]logger_second(main.py).__init__(line151)/thread21536::[Logger.logger_second] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__logger_second.log]
2024-04-26 12:12:34,973[DEBUG]logger_second(example1.py).<module>(line19)/thread21536::hello2-1
2024-04-26 12:12:34,974[DEBUG]logger_second(example1.py).<module>(line23)/thread21536::hello2-2

5. logger__root.log

2024-04-26 12:12:34,965[DEBUG]root(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,965[DEBUG]root(main.py).__init__(line148)/thread21536::[Logger.root] start STREAM
2024-04-26 12:12:34,965[DEBUG]root(main.py).__init__(line151)/thread21536::[Logger.root] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__root.log]
2024-04-26 12:12:34,965[DEBUG]root(example1.py).<module>(line10)/thread21536::None
2024-04-26 12:12:34,965[DEBUG]root(example1.py).<module>(line11)/thread21536::True
2024-04-26 12:12:34,968[DEBUG]root(example1.py).<module>(line12)/thread21536::
2024-04-26 12:12:34,968[DEBUG]root(example1.py).<module>(line13)/thread21536::hello0-1
2024-04-26 12:12:34,970[DEBUG]logger_first(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,970[DEBUG]logger_first(main.py).__init__(line148)/thread21536::[Logger.logger_first] start STREAM
2024-04-26 12:12:34,971[DEBUG]logger_first(main.py).__init__(line151)/thread21536::[Logger.logger_first] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__logger_first.log]
2024-04-26 12:12:34,971[DEBUG]logger_first(example1.py).<module>(line16)/thread21536::hello1-1
2024-04-26 12:12:34,972[DEBUG]logger_second(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,973[DEBUG]logger_second(main.py).__init__(line148)/thread21536::[Logger.logger_second] start STREAM
2024-04-26 12:12:34,973[DEBUG]logger_second(main.py).__init__(line151)/thread21536::[Logger.logger_second] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__logger_second.log]
2024-04-26 12:12:34,973[DEBUG]logger_second(example1.py).<module>(line19)/thread21536::hello2-1
2024-04-26 12:12:34,974[DEBUG]root(example1.py).<module>(line21)/thread21536::hello0-2
2024-04-26 12:12:34,974[DEBUG]logger_first(example1.py).<module>(line22)/thread21536::hello1-2
2024-04-26 12:12:34,974[DEBUG]logger_second(example1.py).<module>(line23)/thread21536::hello2-2
2024-04-26 12:12:34,975[DEBUG]logger_dir(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,975[DEBUG]logger_dir(main.py).__init__(line148)/thread21536::[Logger.logger_dir] start STREAM
2024-04-26 12:12:34,976[DEBUG]logger_dir(main.py).__init__(line151)/thread21536::[Logger.logger_dir] start FILE=[c:\1\logger__logger_dir.log]
2024-04-26 12:12:34,976[DEBUG]logger_dir(example1.py).<module>(line27)/thread21536::hello_dir
2024-04-26 12:12:34,977[DEBUG]Example(main.py).__init__(line145)/thread21536::====================================================================================================
2024-04-26 12:12:34,977[DEBUG]Example(main.py).__init__(line148)/thread21536::[Logger.Example] start STREAM
2024-04-26 12:12:34,977[DEBUG]Example(main.py).__init__(line151)/thread21536::[Logger.Example] start FILE=[C:\__STARICHENKO_Element\PROJECTS\abc=logger_aux\EXAMPLES\logger__Example.log]
2024-04-26 12:12:34,977[DEBUG]Example(example1.py).meth(line39)/thread21536::hello123

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

logger_aux-0.0.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

logger_aux-0.0.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file logger_aux-0.0.4.tar.gz.

File metadata

  • Download URL: logger_aux-0.0.4.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for logger_aux-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3baf63b9857aee05e59907529af81f6a8f5b2d4ef922e5736d801209c8b3cfc1
MD5 725ee1f09c12b691f3ba4f6c065653db
BLAKE2b-256 a7bd61af518b0f61ad6c4a44734fc76ba2e74c959bb2aa077fc448c656e77002

See more details on using hashes here.

File details

Details for the file logger_aux-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: logger_aux-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for logger_aux-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4eb48a0afb97e12455fa33af6f735ed2493cf003780e17fb370efcc863ad66d9
MD5 67224a4842019ef7864d6b68bfdabe27
BLAKE2b-256 4ae6c3211febc0957241a012933d8db376fdb00fbd2a8d709ac745b4c79d7235

See more details on using hashes here.

Supported by

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