You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In any regular app, this is easy to confuse with the regular application logs. And more importantly - it's hard to tell apart when you want to debug posthog specifically.
It would be great if the logger had some set prefix.
The text was updated successfully, but these errors were encountered:
def fix_posthog_logging(posthog: Posthog):
class PosthogClientLogPrefixFilter(logging.Filter):
def filter(self, record):
record.msg = f'[PostHog-Client] {record.msg}'
return True
for f in posthog.log.filters:
if isinstance(f, PosthogClientLogPrefixFilter) or f.__class__.__name__ == 'PosthogClientLogPrefixFilter':
return # it's already there!
posthog.log.addFilter(PosthogClientLogPrefixFilter())
It's a bit inefficient re: the message append, and it's weird code because I have to double-check for the filter's presence to avoid adding it twice (something regarding Django initalization I guess)
Today, (in debug, since that's what I use) the library logs arbitrary stuff like:
In any regular app, this is easy to confuse with the regular application logs. And more importantly - it's hard to tell apart when you want to debug posthog specifically.
It would be great if the logger had some set prefix.
The text was updated successfully, but these errors were encountered: