Skip to content

Commit 703033c

Browse files
author
huhao
committed
logger
1 parent b31871f commit 703033c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/snipcode.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
独立日志
22

3-
logging.basicConfig(filename=os.path.join(os.getcwd(), 'log.log'), level = logging.DEBUG)
3+
logfile = '/data/log/login_mon/%s.log' % datetime.now().strftime('%Y-%m-%d')
4+
logging.basicConfig(filename=logfile, level=logging.INFO, format='%(asctime)s - %(message)s')
5+
logging.getLogger().addHandler(logging.StreamHandler())
46

57
def init_logger(log_filename, level='info', console=False):
68
import logging.handlers

0 commit comments

Comments
 (0)