Skip to main content

A tiny logger tool for Python

Project description

nanologger

nanologger is a tiny logger made with Python.

It includes basic functionality such as

  1. A basic log
  2. Warning logs
  3. Fatal logs
  4. Success logs

This tiny package also includes time format editing and enabling/disabling colors

Example code:

import nanologger as log

print("The first three logs will be printed, and will not exit on Fatal call")
log.Log("Database service is up")
log.Warning("File not found, using default directory")
log.Fatal("Cannot connect to server", exit = False)
log.Success("Operation Complete\n")

print("Next three logs will be printed without color")
log.hasColor = False
log.Log("Database service is up")
log.Warning("File not found, using default directory")
log.Fatal("Cannot connect to server", exit = False)
log.Success("Operation Complete\n")

print("Next three logs will be printed without timestamp")
log.hasColor = True
log.hasTimestamp = False
log.Log("Database service is up")
log.Warning("File not found, using default directory")
log.Fatal("Cannot connect to server", exit = False)
log.Success("Operation Complete\n")

print("Next three logs will be printed in a different time format, and exit on Fatal call")
log.hasTimestamp = True
log.hasColor = True
log.timeFormat = "%Y-%m-%d"
log.Log("Database service is up")
log.Warning("File not found, using default directory")
log.Fatal("Cannot connect to server")
log.Success("Operation Complete")

Methods:

  1. Log prints a log with a timestamp
  2. Warning prints a warning with timestamp
  3. Fatal prints a fatal log (does not terminate program)
  4. Success prints a success log

Variables:

  1. timeFormat is a string, supports regular Python timestamps default: "%d-%m-%Y %H:%M:%S"
  2. hasColor is a boolean that sets/removes color from the logs default: True
  3. hasTimestamp is a boolean that sets/removes the timestamp default: True

Installation

Install the package by running

pip install nanologger

Import it with

import nanologger

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

nanologger-1.0.2.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

nanologger-1.0.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file nanologger-1.0.2.tar.gz.

File metadata

  • Download URL: nanologger-1.0.2.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for nanologger-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f4524507420a4a2cbe7baa35276956d95d21244bb96d3049ebc94452d59e09ba
MD5 6317fa6aec2df2db4c8117095559c7b5
BLAKE2b-256 e650704a6d17c4aaf594221137702c170e480845b93935a5939b79006e794694

See more details on using hashes here.

File details

Details for the file nanologger-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: nanologger-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for nanologger-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 465271d3a4451c4ee6da24a527d7f858764f03b7faaf47d67dfb2c27a7a7a71a
MD5 4e5167c9c8906b64bd43df9b4ad487dd
BLAKE2b-256 faa97f201e7df3d56373727106db4a4b16f21bf0a3d6debdd9793b2cbde5cff4

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