Skip to content

Commit

Permalink
Add logging to file
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Dec 7, 2024
1 parent 3bf77f7 commit f020829
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions labelme_toolkit/_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys

import click
Expand All @@ -16,9 +17,18 @@
@click.group(context_settings=dict(help_option_names=["-h", "--help"]))
@click.version_option(__version__)
def cli():
logger.remove()
logger.remove(0)
logger.add(
sys.stderr, level="INFO", colorize=True, format="<level>{message}</level>"
sys.stderr,
level="INFO",
colorize=True,
format="<level>{message}</level>",
backtrace=False,
diagnose=False,
)
os.makedirs(os.path.expanduser("~/.cache/labelme"), exist_ok=True)
logger.add(
os.path.expanduser("~/.cache/labelme/toolkit.log"), colorize=True, level="DEBUG"
)


Expand Down

0 comments on commit f020829

Please sign in to comment.