Skip to content

Commit 06407f3

Browse files
committed
Add option -d/--debug to enable debug logging
1 parent 3f8f6f7 commit 06407f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

telegram2elastic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ def main():
338338
argument_parser = argparse.ArgumentParser(description="A simple Telegram client writing chat messages to multiple outputs in realtime")
339339

340340
argument_parser.add_argument("--config", "-c", help="path to your config file", default=os.getenv("CONFIG_FILE", "config.yml"))
341+
argument_parser.add_argument("--debug", "-d", help="print debug output", action="store_true")
341342

342343
sub_command_parser = argument_parser.add_subparsers(dest="command", required=True)
343344

@@ -352,7 +353,7 @@ def main():
352353

353354
arguments = argument_parser.parse_args()
354355

355-
logging.basicConfig(format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s", level=logging.WARNING)
356+
logging.basicConfig(format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s", level=logging.DEBUG if arguments.debug else logging.WARNING)
356357
logging.addLevelName(LOG_LEVEL_INFO, "INFO")
357358

358359
with open(arguments.config, "r") as config_file:

0 commit comments

Comments
 (0)