Skip to main content

SimpleLogger

Custom logger class using the builtin logging module

  • Simplifies logging to a file
  • Adds color formatting
  • Adds ability to set verbosity through environment variable 'BBLOGGER_VERBOSITY'

Logger class

class SimpleLogger( logging.getLoggerClass() ):

        """
        All options and keyword arguments are optional

        Arguments:
            'name':  str - name given to logger
            'level': int [1-5] - terminal output logging level - default is 3

        Keyword Arguments:
            'date_fmt':        str ['%H:%M:%S'] - date format string
            'html_theme':      str ['plain'] - html theme to use when writing html or pdf
                                - see SimpleLogger.view_html_themes() to print examples
            'terminal_output': bool [True] - whether or not to output logs to terminal
            'logfile':         str - plaintext log file to write in realtime
            'overwrite':       bool [False] - overwrite logfile at initial start of program if existing
            'logfile_level':   int [1-4] - limit logs at or above level given - default is 1
            'logfile_title':   str - prepend text to logfile (shows date and time only by default)
                                - also applies to html/pdf if used
            'to_html':         str [path] - write logs to an html file at exit of program
            'to_pdf':          bool - use with 'to_html' to instead save a pdf
                                - REQUIREMENT: chrome or chromium and bash in system path
        """


from simplelogger import SimpleLogger
log = SimpleLogger( __name__, 2, logfile = "/home/user/log/my-logfile" )

#
# Setting level does not effect log file
# Log file recieves all logs by default
#

Changelog

  • v0.1.0
    • initial release

Metadata

Release files for bb-simplelogger 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bb-simplelogger 0.1.0
File Size Uploaded
bb_simplelogger-0.1.0.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for bb-simplelogger 0.1.0
File Interpreter ABI Platform
bb_simplelogger-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / bb_simplelogger-0.1.0.tar.gz

Download URL bb_simplelogger-0.1.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
83108aff341246efab5bfeae4e5932519a8c350e9b00c14f34ab80e3ce94f15a
BLAKE2b-256 checksum
How to use checksums
0dbbdb4c7fccfa049c36db1c8829a6618a6f5f9a67bc59528fac6f238b8c7e59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Linux/6.6.47-1-lts

Release files / bb_simplelogger-0.1.0-py3-none-any.whl

Download URL bb_simplelogger-0.1.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
87887fbd59e01f1b3833f90f56a4b149d3e0045224056c5e4a34348b9c5cb787
BLAKE2b-256 checksum
How to use checksums
b18831d98a253aa5de20a403e5a6855e896ec1d6824dc178554d23912d414360
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Linux/6.6.47-1-lts

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page