fixing double logging

This commit is contained in:
aj 2020-01-26 14:07:17 +00:00
parent 56da9fcc77
commit 8e88ae2a3e

View File

@ -12,14 +12,13 @@ spotfm_logger = logging.getLogger('spotfm')
if os.environ.get('DEPLOY_DESTINATION', None) == 'PROD': if os.environ.get('DEPLOY_DESTINATION', None) == 'PROD':
import google.cloud.logging import google.cloud.logging
from google.cloud.logging.handlers import CloudLoggingHandler, setup_logging from google.cloud.logging.handlers import CloudLoggingHandler
log_format = '%(funcName)s - %(message)s' log_format = '%(funcName)s - %(message)s'
formatter = logging.Formatter(log_format) formatter = logging.Formatter(log_format)
client = google.cloud.logging.Client() client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client, name="music-tools") handler = CloudLoggingHandler(client, name="music-tools")
setup_logging(handler)
handler.setFormatter(formatter) handler.setFormatter(formatter)