Skip to content

Commit

Permalink
console handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gpchelkin committed Jun 28, 2017
1 parent c45d85f commit 7367cc4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions scdlbot/scdlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,19 @@
from telegram.contrib.botan import Botan
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, InlineQueryHandler, CallbackQueryHandler

# from transliterate import translit

# class ContextFilter(logging.Filter):
# hostname = socket.gethostname()
#
# def filter(self, record):
# record.hostname = ContextFilter.hostname
# return True

# filt = ContextFilter()
# logger.addFilter(filt)

# http://help.papertrailapp.com/kb/configuration/configuring-centralized-logging-from-python-apps/
console_handler = logging.StreamHandler()
handlers = [console_handler]

SYSLOG_ADDRESS = os.getenv('SYSLOG_ADDRESS', '')
handlers = []
if SYSLOG_ADDRESS:
syslog_hostname, syslog_udp_port = SYSLOG_ADDRESS.split(":")
syslog_udp_port = int(syslog_udp_port)
syslog_handler = SysLogHandler(address=(syslog_hostname, syslog_udp_port))
handlers.append(syslog_handler)
logging.basicConfig(format='%(asctime)s {} %(name)s: %(message)s'.format('heroku'), datefmt='%b %d %H:%M:%S',

logging.basicConfig(format='%(asctime)s {} %(name)s: %(message)s'.format(os.getenv("HOSTNAME", "host")),
datefmt='%b %d %H:%M:%S',
level=logging.DEBUG, handlers=handlers)
logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 7367cc4

Please sign in to comment.