An simple, async, full package name path, log rotating, different colored log library.
Project description
# Aelog
An simple, async, full package name path, log rotating, different colored log library.
aelog aims to make using python log as simple as possible. as a result, it drastically
simplifies using python logging.
aelog's design objectives:
- Make using python log as simple as possible.
- Output log contains the full package name path.
- Provide asynchronous log output function, at the same time, contains common log output.
- Output according to the log level to mark the different colors separately.
- Provide a log file rotating, automatic backup.
- Output to the terminal and file, default output to the terminal, if you don't provide the log file path.
# Installing aelog
- ```pip install aelog```
# init aelog
```
import aelog
app = Flask(__name__)
aelog.init_app(app)
# or
aelog.init_app(aelog_access_file='aelog_access_file.log', aelog_error_file='aelog_error_file.log',
aelog_console=False)
```
# aelog config
List of configuration keys that the aelog extension recognizes:
| configuration key | the meaning of the configuration key |
| ------ | ------ |
| AELOG_ACCESS_FILE | Access file path, default None. |
| AELOG_ERROR_FILE | Error file path, default None. |
| AELOG_CONSOLE | Whether it is output at the terminal, default false. |
| AELOG_MAX_BYTES | Log file size, default 50M. |
| AELOG_BACKUP_COUNT | Rotating file count, default 5.|
# Usage
### simple using, not initialized.
```
import aelog
def test_aelog_output_console():
"""
Args:
Returns:
"""
aelog.debug("simple debug message")
aelog.info("simple info message")
aelog.warning("simple warning message")
aelog.error("simple error message")
aelog.critical("simple critical message")
try:
5 / 0
except Exception as e:
aelog.exception(e)
```
This will output to the terminal.

- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
### To initialize, output log to file and terminal.
```
import aelog
from flask import Flask
app = Flask(__name__)
aelog.init_app(app) # Output to the test.log file and terminal
def test_aelog_output_file():
"""
Args:
Returns:
"""
aelog.debug("simple debug message")
aelog.info("simple info message")
aelog.warning("simple warning message")
aelog.error("simple error message")
aelog.critical("simple critical message")
try:
5 / 0
except Exception as e:
aelog.exception(e)
```
This will output to the test.log file and terminal.

- Automatic output is greater than the error information to the 'test_error.log' file.
- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
### To initialize, asynchronous output log to file and terminal.
```
import asyncio
import aelog
from sanic import Sanic
app = Sanic(__name__)
aelog.init_aelog(app) # Output to the test.log file and terminal
async def test_async_output():
await aelog.async_debug("simple debug message")
await aelog.async_info("simple info message")
await aelog.async_warning("simple warning message")
await aelog.async_error("simple error message")
await aelog.async_critical("simple critical message")
try:
5 / 0
except Exception as e:
await aelog.async_exception(e)
if "__name__"=="__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(test_async_output())
```
This will output to the test.log file and terminal.

- Automatic output is greater than the error information to the 'test_error.log' file.
- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
An simple, async, full package name path, log rotating, different colored log library.
aelog aims to make using python log as simple as possible. as a result, it drastically
simplifies using python logging.
aelog's design objectives:
- Make using python log as simple as possible.
- Output log contains the full package name path.
- Provide asynchronous log output function, at the same time, contains common log output.
- Output according to the log level to mark the different colors separately.
- Provide a log file rotating, automatic backup.
- Output to the terminal and file, default output to the terminal, if you don't provide the log file path.
# Installing aelog
- ```pip install aelog```
# init aelog
```
import aelog
app = Flask(__name__)
aelog.init_app(app)
# or
aelog.init_app(aelog_access_file='aelog_access_file.log', aelog_error_file='aelog_error_file.log',
aelog_console=False)
```
# aelog config
List of configuration keys that the aelog extension recognizes:
| configuration key | the meaning of the configuration key |
| ------ | ------ |
| AELOG_ACCESS_FILE | Access file path, default None. |
| AELOG_ERROR_FILE | Error file path, default None. |
| AELOG_CONSOLE | Whether it is output at the terminal, default false. |
| AELOG_MAX_BYTES | Log file size, default 50M. |
| AELOG_BACKUP_COUNT | Rotating file count, default 5.|
# Usage
### simple using, not initialized.
```
import aelog
def test_aelog_output_console():
"""
Args:
Returns:
"""
aelog.debug("simple debug message")
aelog.info("simple info message")
aelog.warning("simple warning message")
aelog.error("simple error message")
aelog.critical("simple critical message")
try:
5 / 0
except Exception as e:
aelog.exception(e)
```
This will output to the terminal.

- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
### To initialize, output log to file and terminal.
```
import aelog
from flask import Flask
app = Flask(__name__)
aelog.init_app(app) # Output to the test.log file and terminal
def test_aelog_output_file():
"""
Args:
Returns:
"""
aelog.debug("simple debug message")
aelog.info("simple info message")
aelog.warning("simple warning message")
aelog.error("simple error message")
aelog.critical("simple critical message")
try:
5 / 0
except Exception as e:
aelog.exception(e)
```
This will output to the test.log file and terminal.

- Automatic output is greater than the error information to the 'test_error.log' file.
- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
### To initialize, asynchronous output log to file and terminal.
```
import asyncio
import aelog
from sanic import Sanic
app = Sanic(__name__)
aelog.init_aelog(app) # Output to the test.log file and terminal
async def test_async_output():
await aelog.async_debug("simple debug message")
await aelog.async_info("simple info message")
await aelog.async_warning("simple warning message")
await aelog.async_error("simple error message")
await aelog.async_critical("simple critical message")
try:
5 / 0
except Exception as e:
await aelog.async_exception(e)
if "__name__"=="__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(test_async_output())
```
This will output to the test.log file and terminal.

- Automatic output is greater than the error information to the 'test_error.log' file.
- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
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
aelog-1.0.3.tar.gz
(6.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
aelog-1.0.3-py3-none-any.whl
(6.6 kB
view details)
File details
Details for the file aelog-1.0.3.tar.gz.
File metadata
- Download URL: aelog-1.0.3.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e283110b2a089d861c112ec98ad6af7345ffb3089a2ba285a94974d88fafbd00
|
|
| MD5 |
c4794f4b68fd91ad349469de22d2c400
|
|
| BLAKE2b-256 |
d7990616c422617111ce630c9bb3e84b32875a02f8be065fcc84d5a8148e8416
|
File details
Details for the file aelog-1.0.3-py3-none-any.whl.
File metadata
- Download URL: aelog-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e00c109d8159172fb384450c2417a3e3452c37acc18b20547335724129c31a2f
|
|
| MD5 |
8576d8731d54562d1caba30bbff6a752
|
|
| BLAKE2b-256 |
60e334539d01b4726a269527312838cbd4cd3c6394df977ffc328b4b09059f54
|