anastasia-logger 0.1.0
Anastasia Logging Standarization
Requires Python: >=3.8,<4.0

# **Anastasia Logging** :bookmark_tabs: #

This repository holds a logging implementation wrapper for python scripts with standarized code notifications and API tool interactions.

## **<u>Summary</u>** :scroll: ##

1. About *logging* python library
2. Enhancements and additional functionalities
    1. Log Output Standarization
    2. Code Tags Standarization
3. Versioning

## **<u>1. About *logging* Python Library</u>** :pencil: ##

This repository is based in python base log management library called [logging](https://docs.python.org/3/library/logging.html).

Commonly, when this library is intended to be used, for a basic usage a simple logging import is recommended to be used in order to avoid additional settings in our internal scripts.

```
import logging

logging.warning("I am a very usefull warning")

OUTPUT => WARNING:root:I am a very usefull warning
```

But, for more complex repositories, is recommended to manage different loggers according to their necessities. For a customized logging behaviour, a Logger class must be declared from logging.

```
import logging

logger = logging.Logger("custom_logger")
logger.warning("I am a very usefull warning")

OUTPUT => I am a very usefull warning
```

Have you noticed in the first import logging example that appears the word *root* in the output console? This is because when you use logging import directly, a default Logger class is instanciated with name *root* along with default configurations.

This repository contains a class called **AnastasiaLogger**, which inherits from Logger class and standarize logging definitions and has some improvments over information (*.info()*), warning (*.warning()*) and error (*.error()*) methods.

```
from anastasia_logging import AnastasiaLogger

logger = AnastasiaLogger()
logger.warning("I am a very usefull warning")

OUTPUT => 2023-05-08 10:39:17 UTC/GMT-0400 | [ANASTASIA-JOB] WARNING: I am a very usefull warning
```

If a script implementation already has a logging implementation, it is possible to change it with AnastasiaLogger and no modifications are required from the script side.

## **<u>2. Enhancements and Additional Functionalities</u>** :wrench: ##

### **2.1 Log Output Standarization** ###

AnastasiaLogger has a common strcuture in order to show information, which is the following one:
```
YYYY-MM-DD HR:MN:SS UTC/GMT(+-)HHMN | [TAG] LEVEL: message
```
TAG is define by default as ANASTASIA-JOB (can be changed during class instantiation), and LEVEL is defined according to level method called.

TAG is intended to differentiate responsabilities along scripts in other repositories.

### **2.2 Code Tags Standarization** ###

In order to have a common identification for upper level implementations, AnastasiaLogger holds a standarized code implementations according to different topics.

The coding structure is the following one:

| **Code** 	|         **Topic**      	|
|:---------:|:-------------------------:|
|     0    	|       Unindentified       |
|    1XX   	|       Data related      	|
|    2XX   	|   Mathematical related    |
|    3XX   	|        AI related         |
|    4XX   	|     Resources related 	|
|    5XX   	| Operative System related 	|
|    6XX   	|       API related         |
|    7XX   	|       AWS related         |

Methods info(), warning() and error() can be declared with a code as parameter in order to extended log with a code description.

```
from anastasia_logging import AnastasiaLogger

logger = AnastasiaLogger()
logger.warning("I am a dataset warning", 100)

OUTPUT => 2023-05-08 11:55:27 UTC/GMT-0400 | [ANASTASIA-JOB] WARNING: <W100> I am a dataset warning
```

If a code is already predefined and no message is introduced, a default message will appear according to code declared.

## **<u>3. Versioning</u>** :notebook: ##

### v1.0.0 ###

* New Features :tada: :

    * Anastasia *Logger* Class abstraction
    * Standar code description definitions for INFO, WARNING and ERROR