Skip to main content

Simple Timed logger, it write logs to terminal. Can write elapsed time between logs

Project description

Simple Timed Logger

It's logging package for very basic log messages.

It has 5 levels of logs (DEBUG, INFO, WARNING, ERROR, CRITICAL). By using unique keys, it is possible to measure elapsed time between 2 log messages

Logging is done by these methods:

  • log()
  • debug()
  • info()
  • warning()
  • error()
  • critical()

log() method can be set to log message on any level.

All logging methods take these keyword arguments:

  • timed - (True/False) Is log message timed
  • key - Unique key for timed log message. Use this key to stop logging and print out elapsed time.

If key is not provided for timed logging, it will be automatically generated. To stop timed logging, use stop_timed_log() method. By passing key of log timer you want to stop. If no key is given, it will stop last started timed log.

using basic_config() it is possible to configure what lowest level of log messages will be printed to terminal

Exaple of usage:

from simpleTimedLogger import SimpleTimedLogger # Import logger to file

logger = SimpleTimedLogger.Logger() # Create instance of a logger class
logger.basic_config(min_level_of_logging=logger.DEBUG) # Set minimum level of messages to be printed in terminal

logger.debug("This prints message to terminal as debug message")

logger.start_timed_log("This starts timed log and prints message to terminal")
logger.end_timed_log("This ends timed log and prints message to terminal and shows elapsed time")

logger.start_timed_log("You can also provide your own key and message level", level=logger.ERROR, key='function name')
logger.end_timed_log('You can also end timed log based on key', key='function name')

logger.log(msg='You can start timed logs this way too', timed=True, level=logger.INFO)
logger.end_timed_log('When key not provided, it ends last started timed log')

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

simpletimedlogger-2.0.2.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

simpletimedlogger-2.0.2-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file simpletimedlogger-2.0.2.tar.gz.

File metadata

  • Download URL: simpletimedlogger-2.0.2.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for simpletimedlogger-2.0.2.tar.gz
Algorithm Hash digest
SHA256 53e7f9b7ebce1e8062de5b4d28a1aa24230ed694fe0b1bf20c65bf8436991f73
MD5 a7df055dc0143aee073a5326d519d57d
BLAKE2b-256 5d4bd48d80d3d7b0fbb51cd3bb27653dc33ca91569434099ebd90fd764040741

See more details on using hashes here.

File details

Details for the file simpletimedlogger-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simpletimedlogger-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 179d1c9485fa0c4c47bdb362da5cad6b34a8a6828632b71a76b0c80bc31b58b8
MD5 a7837f0f344216552be6ff539b94e5fb
BLAKE2b-256 17154f64d4e7d36397d0f0db5bd6096a937ba07d5804254b13e919c80280d59b

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