tiramisu/tiramisu/log.py

31 lines
1.2 KiB
Python
Raw Normal View History

2019-02-24 19:03:00 +01:00
# -*- coding: utf-8 -*-
"logger for tiramisu"
2021-02-24 20:30:04 +01:00
# Copyright (C) 2019-2021 Team tiramisu (see AUTHORS for all contributors)
2019-02-24 19:03:00 +01:00
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ____________________________________________________________
2019-03-23 08:26:39 +01:00
from logging import getLogger, DEBUG, basicConfig, StreamHandler, Formatter
import os
2019-02-24 19:03:00 +01:00
log = getLogger('tiramisu')
2019-03-23 08:26:39 +01:00
if os.environ.get('TIRAMISU_DEBUG') == 'True':
log.setLevel(DEBUG)
handler = StreamHandler()
handler.setLevel(DEBUG)
formatter = Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)