gllogger
Project description
# NOTE: You should import gllogger before executing any other code.
from gllogger import gL
gL.enableGlobalHandler(True)
gL.setGlobalLevel(logging.DEBUG)
...
# You can log into the console,
gL.getLogger(__name__).init(gL.OT_console)
# or you can pass logs into a function,
def gL_function(text):
print(text)
gL.setFunction(gL_function)
gL.getLogger(__name__).init(gL.OT_function)
# or you can write logs to files.
import os
gL.setLogDir(os.path.join(os.getcwd(), "log", ))
gL.getLogger(__name__).init(gL.OT_logging)
# Then, use the following function anywhere to log.
gL.debugs("a", 1, True, )
gL.infos()
gL.warns()
gL.errors()
"""
[DEBUG 00:00:00 main[15].<module>] a 1 True
"""
# You can use 'gL(Exception)' to enable logging of complete exception tracebacks,
# and if you have 'better_exceptions' installed, the tracebacks will be even more detailed.
# $ pip install better_exceptions
try:
def f(a, b):
return a / b
f(1, 0)
except ZeroDivisionError as e:
gL.warns(gL(e))
"""
[WARNING 00:00:00 main[10].<module>] Traceback (most recent call last):
File "/tmp/main.py", line 8, in <module>
f(1, 0)
└ <function f at 0x04E264A8>
File "/tmp/main.py", line 6, in f
return a / b
│ └ 0
└ 1
"""
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
gllogger-0.0.8.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file gllogger-0.0.8.tar.gz
.
File metadata
- Download URL: gllogger-0.0.8.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19d0e3c11371038ecae3f14706c0298eb0702698415dcc849e35015f1e84e080 |
|
MD5 | 4ea579cbe70059bdbfa5657f68c1c303 |
|
BLAKE2b-256 | 100049e89e3e4d2a5620779437137a191ed26cf3af433ea63be9d77d5064d888 |
File details
Details for the file gllogger-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: gllogger-0.0.8-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 975088a6b29eb3a323e024017895c4e473724d32089219c4b6951f6f6f833d0b |
|
MD5 | b4001ea7d072a977e76982dc8b9c764d |
|
BLAKE2b-256 | 319af948ec7e798339313e31a66bbf05d440c77ce8ddf329a3683725b42edff1 |