semvec/pypi-packages huggingface dataset:
aiologging 1.0.1
Asynchronous module for logging in python.
Requires Python: >=3.11
Keywords: aio log logger logging aiolog aiologger aiologging

# aiologging #

## What's new in 1.0.1? ##

**Fixed bugs:**
> By passing the level in 'str' to "logger.log()", specifying any text that will be used for recording.

> It is possible to specify the level in 'int' in "logger.log()" less than 0 and greater than 5, so the log was at the level of 'None'.

**New function**

> async def error_handler(time, name, level: str, msg):

It is used to handle errors on behalf of the module. It is not recommended to use it externally.

## What is this? ##
**aiologging** - asynchronous module for logging asynchronous applications.

#### Starting from version 2.0.0, logs will be written to a file and output to "print", specifying this in "aiologging.Logger()", before version 2.0.0 they were output only in "print()". ####

## Quick Guide

---

**Connecting the module:**
> import aiologging

---

**Getting the logger:**
> logger = aiologging.Logger(name="logger name")

The 'name=' parameter is optional, the default value is 'root'.

---

**Logging:**
> await logger.log(level, message)

> await logger.log(2, message) # level = INFO (int)

> await logger.log("INFO", message) # level = INFO (str)

> await logger.log(aiologging.INFO, message) # level = INFO (int)

> from aiologging import NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL
> await logger.log(INFO, message) # level = INFO (int)

Replace 'INFO' or '2' with the desired int/str level.

level is 'str' or 'int'.

| str | int |
|--|--|
| CRITICAL, FATAL | 5 |
| ERROR | 4 |
| WARNING, WARN | 3 |
| INFO | 2 |
| NOTSET | 0 |
| DEBUG | 1 |

---

### the records have the following format: ###
> 2025-01-18 16:10:16.271609 :: NAME :: LEVEL :: MESSAGE

**2025-01-18 16:10:16.271609 - date and time of the log.**
**NAME - the name of the logger, by default 'root'.**
**LEVEL - log level (NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL).**
**MESSAGE - the log message.**

---

# Other functions #

---

> async def levelToName(level: int):

Accepts level in 'int' and returns 'str' the name of the level (2 - "INFO")

---

> async def nameToLevel(level: str):

Accepts level name in 'str' and returns 'int' the number of the level ("INFO" - 2)

---

# Global variables #

---

CRITICAL = 5
FATAL = CRITICAL
ERROR = 4
WARNING = 3
WARN = WARNING
INFO = 2
DEBUG = 1
NOTSET = 0

---

_levelToName = {
    CRITICAL: 'CRITICAL',
    ERROR: 'ERROR',
    WARNING: 'WARNING',
    INFO: 'INFO',
    DEBUG: 'DEBUG',
    NOTSET: 'NOTSET',
}

---

_nameToLevel = {
    'CRITICAL': CRITICAL,
    'FATAL': FATAL,
    'ERROR': ERROR,
    'WARN': WARNING,
    'WARNING': WARNING,
    'INFO': INFO,
    'DEBUG': DEBUG,
    'NOTSET': NOTSET,
}

---