Skip to content

Commit

Permalink
connection.py: fix logging
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Rusak <[email protected]>
  • Loading branch information
lrusak committed May 16, 2024
1 parent da6852d commit b07055c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/libeagle/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
Type,
)

import sys


class Connection(object):
def __init__(
Expand All @@ -32,7 +34,18 @@ def __init__(
debug:bool Enable debug logging
"""

self.logger = logging.getLogger()
format = logging.Formatter(
"%(asctime)s - [%(levelname)s] - %(message)s", "%Y-%m-%d %H:%M:%S"
)

handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(format)

if debug:
handler.setLevel(logging.DEBUG)

self.logger = logging.getLogger("libeagle")
self.logger.addHandler(handler)

if debug:
self.logger.setLevel(logging.DEBUG)
Expand Down

0 comments on commit b07055c

Please sign in to comment.