Skip to main content

Simple logger. Simple to use. Simple to modify.

Project description

Nyanger - simple logger

Nyanger is a simple logger designed to be simple to use and simple to modify.

Creation of Nyanger was motivated by the need of a simple logging facility for simple everyday scripts as well as simple logging solution for complex multiprocessing code.

Nyanger designed to be simultaneously: working solution, prototype, and code example. So use Nyanger as is, extend it with LogWriters, or modify source code to fill your needs.

Nyanger consist of 3 modules:

  • async (for the use with asyncio)
  • process (for use with code of any complexity, but especially complex multiprocessing/multithreading code)
  • simple (for plain simple scripts or multithreading code)

Compatibility

Nyanger compatible with Linux (and probably any *NIX), and probably with Windows (feel free to test and report any issues)

Usage

All 3 modules follow same pattern:

  1. Nyanger is our logger class. You need to get instance of it ether by creating object manually or by calling get_logger method.
  2. You must provide list of LogWriter objects to Nyanger constructor, if get_logger called without this list then default console LogWriter will be created.
  3. You can create your own log writes by implementing LogWriter abstract class.
  4. You start logger by calling start() method.
  5. You use it by calling other() info() warning() error() debug() or log() methods of Nyanger instance.
  6. Before ending your program you're stopping logger by calling stop() method.

Example

Init Nyanger directly:

import nyanger.process as nya
import nyanger.process.log_writers.console_writer as cwr

log: nya.Nyanger

if __name__ == '__main__':
    # Init logger
    log = nya.Nyanger("pur", loging_level=nya.LogLevel.DEBUG, log_writers=[cwr.ConsoleWriter()])

    log.start()
    log.other("Other test pur")
    log.info("Info test put")
    log.warning("Warning test pur")
    log.error("Error test pur")
    log.debug("Debug test pur")
    log.stop()

Using get_logger helper:

import nyanger.process.static as nya_stat

# Init logger
log = nya_stat.get_logger("nyan")

if __name__ == '__main__':
    log.start()
    log.other("Other test pur")
    log.info("Info test put")
    log.warning("Warning test pur")
    log.error("Error test pur")
    log.debug("Debug test pur")
    log.stop()

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

nyanger-0.9.2.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

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

nyanger-0.9.2-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file nyanger-0.9.2.tar.gz.

File metadata

  • Download URL: nyanger-0.9.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for nyanger-0.9.2.tar.gz
Algorithm Hash digest
SHA256 6e82352788178c07055748dec12fcc795cfcea1c244f2a05682e9955ee480269
MD5 d97d7e2b90122c1e672d98002d1dae4e
BLAKE2b-256 42d5e061f13b6581536c54a538a3c485057cd0f52663417fc0fd96e0a5e1f587

See more details on using hashes here.

File details

Details for the file nyanger-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: nyanger-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for nyanger-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6b3c0f085e05f1fef4d06556ed4aa86d0f860be3d0ab12428a5672c015dcb7b
MD5 fdb1a55fd0e5a52c968312bb56c9e29a
BLAKE2b-256 bb8215911c798f047a7e5ef00bdd692e4a96b25fd7fb54455e712363f88fb5b7

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