Skip to content

Move webhook handler logs to logging at DEBUG level #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2016
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.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy