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

Warning: Windows does not support color in console, so it is automatically disabled

Example code:

import nanologger as log

print("The first four 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 four 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 four 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 (terminates program if appropeiate value set)
  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.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

nanologger-1.0.3-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanologger-1.0.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.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.3.tar.gz
Algorithm Hash digest
SHA256 541e6d00a0eb8d0b4a72055501b363383b579372fbbce2d74b0b6348bfa7e931
MD5 57f64a401facff9f6201c0b03c6a9cc3
BLAKE2b-256 8ecfd32cf9e9edc411aa9bc9a8108b2ba00e4475a3ef9c4d25a7db2c8c1b65ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanologger-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 46eb74169a271abc4468214aea70b4628f3e0763a34187b700b79919178122ad
MD5 17b3681263f47578a8cda743e9dfb163
BLAKE2b-256 2711f2d42cda0e70ef471391145a07bd983d4cbf9ef94d7af4353a62a996e312

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