@@ -40,10 +40,12 @@ List of configuration keys that the aelog extension recognizes:
4040| AELOG_BACKUP_COUNT | Rotating file count, default 5.|
4141
4242# Usage
43- ### simple using, not initialized .
43+ ### simple using, output log to terminal .
4444```
4545import aelog
4646
47+ aelog.init_app(aelog_console=True)
48+
4749def test_aelog_output_console():
4850 """
4951
@@ -52,11 +54,11 @@ def test_aelog_output_console():
5254 Returns:
5355
5456 """
55- aelog.debug("simple debug message")
56- aelog.info("simple info message")
57- aelog.warning("simple warning message")
58- aelog.error("simple error message")
59- aelog.critical("simple critical message")
57+ aelog.debug("simple debug message", "other message" )
58+ aelog.info("simple info message", "other message" )
59+ aelog.warning("simple warning message", "other message" )
60+ aelog.error("simple error message", "other message" )
61+ aelog.critical("simple critical message", "other message" )
6062 try:
6163 5 / 0
6264 except Exception as e:
@@ -66,7 +68,7 @@ This will output to the terminal.
6668![ console] ( https://raw.githubusercontent.com/tinybees/aelog/master/docs/output_console.png )
6769- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
6870
69- ### To initialize, output log to file and terminal.
71+ ### output log to file and terminal.
7072```
7173import aelog
7274from flask import Flask
@@ -83,11 +85,11 @@ def test_aelog_output_file():
8385 Returns:
8486
8587 """
86- aelog.debug("simple debug message")
87- aelog.info("simple info message")
88- aelog.warning("simple warning message")
89- aelog.error("simple error message")
90- aelog.critical("simple critical message")
88+ aelog.debug("simple debug message", "other message" )
89+ aelog.info("simple info message", "other message" )
90+ aelog.warning("simple warning message", "other message" )
91+ aelog.error("simple error message", "other message" )
92+ aelog.critical("simple critical message", "other message" )
9193 try:
9294 5 / 0
9395 except Exception as e:
@@ -98,7 +100,7 @@ This will output to the test.log file and terminal.
98100- Automatic output is greater than the error information to the 'test_error.log' file.
99101- Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.
100102
101- ### To initialize, asynchronous output log to file and terminal.
103+ ### asynchronous output log to file and terminal.
102104```
103105import asyncio
104106import aelog
@@ -109,11 +111,11 @@ app = Sanic(__name__)
109111aelog.init_aelog(app) # Output to the test.log file and terminal
110112
111113async def test_async_output():
112- await aelog.async_debug("simple debug message")
113- await aelog.async_info("simple info message")
114- await aelog.async_warning("simple warning message")
115- await aelog.async_error("simple error message")
116- await aelog.async_critical("simple critical message")
114+ await aelog.async_debug("simple debug message", "other message" )
115+ await aelog.async_info("simple info message", "other message" )
116+ await aelog.async_warning("simple warning message", "other message" )
117+ await aelog.async_error("simple error message", "other message" )
118+ await aelog.async_critical("simple critical message", "other message" )
117119 try:
118120 5 / 0
119121 except Exception as e:
0 commit comments