Skip to content

Commit

Permalink
添加 log
Browse files Browse the repository at this point in the history
  • Loading branch information
lemisky committed Apr 28, 2023
1 parent 35eb793 commit 823a7e3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pygtrans/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""谷歌翻译"""
import logging

from .ApiKeyTranslate import ApiKeyTranslate
from .DetectResponse import DetectResponse
Expand All @@ -20,3 +21,14 @@
__all__ = [
'Translate', 'ApiKeyTranslate', 'Null', 'LanguageResponse', 'DetectResponse', 'TranslateResponse'
]

log = logging.getLogger('pygtrans')
_handler = logging.StreamHandler()
_handler.setFormatter(
logging.Formatter(
fmt=f'%(asctime)s datclass.%(levelname)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
)
log.addHandler(_handler)
log.setLevel(logging.INFO)

0 comments on commit 823a7e3

Please sign in to comment.