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:
Nyanger
is our logger class. You need to get instance of it ether by creating object manually or by callingget_logger
method.- You must provide list of
LogWriter
objects toNyanger
constructor, ifget_logger
called without this list then default consoleLogWriter
will be created. - You can create your own log writes by implementing
LogWriter
abstract class. - You start logger by calling
start()
method. - You use it by calling
other()
info()
warning()
error()
debug()
orlog()
methods ofNyanger
instance. - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nyanger-0.9.1.tar.gz
.
File metadata
- Download URL: nyanger-0.9.1.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d94292215dc2a38282cfcb356b54c9c463749c923344288ad347ed64e506394 |
|
MD5 | 1dc067adfcb4e38c3347e2491a8d0264 |
|
BLAKE2b-256 | fd5ce3dc8dd9748db5765bbebd1562c11715fd248ec7d455836e286ecb54164b |
File details
Details for the file nyanger-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: nyanger-0.9.1-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0348dab55a721fd96bb71b77f4e4cd60c3027486196b526fc7da4ca00951fa08 |
|
MD5 | 5dca919b18a5cf6543d2c8306888a7b8 |
|
BLAKE2b-256 | 10ce8a352b26702acfc97e073eb5357478e45c73eb933b3f8af19a96d38df9d0 |