question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binding without creating a new logger

See original GitHub issue

I’m wondering if we can have new APIs that can bind and unbind structured arguments in place (i.e. without creating a new logger). Maybe an add_extra and a remove_extra method? I also think it’ll be useful if Logger._extra can be promoted to a public member for viewing (a getter property would suffice).

The motivation here is that I want to be able to do from loguru import logger from all my modules and get the structured arguments I’ve set elsewhere. I can workaround this issue by keeping my own logger registry or adding values to _extra directly but I think it’ll be nice if this can be officially supported.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
Delgancommented, Dec 1, 2019

The new contextualize() method is available in v0.4.0 just released. 👍

3reactions
Delgancommented, Oct 31, 2019

Fixed on master, finally. 🎉

It uses contextvars for Python 3.7+ and relies on the aiocontextvars backport for earlier versions.

I will close this issue once the next Loguru release is published.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Logging Cookbook — Python 3.11.1 documentation
Running a logging socket listener in production​​ This example setup shows how the workers can write to the same log file without conflicting...
Read more >
Need Solution for multiple slf4j binding without removing other ...
I have created custom Staticbinder inside org.slf4j.impl package to redirect to logback inside my project. but it doesn't worked when converts ...
Read more >
SLF4J Manual
An SLF4J binding designates an artifact such as slf4j-jdk14.jar or slf4j-log4j12.jar used to bind slf4j to an underlying logging framework, say, java.util.
Read more >
Java Logging Basics - The Ultimate Guide To Logging - Loggly
Creating a New Logger. The process of creating a new Logger is similar across logging frameworks, although the exact method names may be...
Read more >
Enabling logging in BIND
Introduction. By default, logs from named are sent to /var/log/syslog via syslog. Goals. Make BIND log more useful information. Notes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found