Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions telegram/utils/webhookhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,19 @@ def _get_content_len(self):
if clen < 0:
raise _InvalidPost(403)
return clen

def log_message(self, format, *args):
"""Log an arbitrary message.

This is used by all other logging functions.

It overrides ``BaseHTTPRequestHandler.log_message``, which logs to ``sys.stderr``.

The first argument, FORMAT, is a format string for the message to be logged. If the format
string contains any % escapes requiring parameters, they should be specified as subsequent
arguments (it's just like printf!).

The client ip is prefixed to every message.
"""

self.logger.debug("%s - - %s" % (self.address_string(), format % args))
Copy link
Contributor

@MWeesenaar MWeesenaar Jul 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8 recommends to use logging in the form of:
self.logger.debug("%s - - %s", self.address_string(), format % args)
See: https://docs.python.org/2/howto/logging.html#logging-variable-data

I shall raise an enhancement issue for this.