ENPICOM Logo API Docs Python SDK Docs Events

enpi_api.examples.logger

Change logger settings

Ways to control the amount of logs and debug info printed by SDK functions.

Change log level setting for enpi_client

Use enpi_api.l2.types.log.LogLevel in enpi_api.l2.client.enpi_api_client to control the amout of logs printed by the SDK functions.

from enpi_api.l2.client.enpi_api_client import EnpiApiClient
from enpi_api.l2.types.log import LogLevel

"""Default log level is `LogLevel.Debug`, it results in a verbose
logger and most of the available information being printed to stdout"""
with EnpiApiClient() as enpi_client:
    pass


"""Log level `LogLevel.Info` will reduce the amount of printed logs,
allowing only the logs "above and equal to" Info level"""
with EnpiApiClient(log_level=LogLevel.Info) as enpi_client:
    pass


"""Setting log level to `LogLevel.Error` will remove most of the logs, only
information about errors will be logged in case of them occurring"""
with EnpiApiClient(log_level=LogLevel.Error) as enpi_client:
    pass
 1'''
 2# Change logger settings
 3
 4Ways to control the amount of logs and debug info printed by SDK functions.
 5
 6##Change log level setting for enpi_client
 7
 8Use enpi_api.l2.types.log.LogLevel in enpi_api.l2.client.enpi_api_client to control the amout of logs printed by the SDK functions.
 9```python
10from enpi_api.l2.client.enpi_api_client import EnpiApiClient
11from enpi_api.l2.types.log import LogLevel
12
13"""Default log level is `LogLevel.Debug`, it results in a verbose
14logger and most of the available information being printed to stdout"""
15with EnpiApiClient() as enpi_client:
16    pass
17
18
19"""Log level `LogLevel.Info` will reduce the amount of printed logs,
20allowing only the logs "above and equal to" Info level"""
21with EnpiApiClient(log_level=LogLevel.Info) as enpi_client:
22    pass
23
24
25"""Setting log level to `LogLevel.Error` will remove most of the logs, only
26information about errors will be logged in case of them occurring"""
27with EnpiApiClient(log_level=LogLevel.Error) as enpi_client:
28    pass
29
30```
31'''