Skip to content
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

How to pass logfire tags via loguru #524

Open
satwikkansal opened this issue Oct 21, 2024 · 1 comment
Open

How to pass logfire tags via loguru #524

satwikkansal opened this issue Oct 21, 2024 · 1 comment
Labels
bug Bug related to the Logfire Python SDK

Comments

@satwikkansal
Copy link

Question

Hi, I've been using logfire with loguru, my configuration is as below

import os
import logfire
from loguru import logger

HANDLERS  = [
    {"sink": sys.stdout, "level": LOG_LEVEL, "format": LOG_FORMAT, "colorize": True},
]

if os.environ.get("LOGFIRE_TOKEN"):
    HANDLERS.append({**logfire.loguru_handler()})
    logfire.configure(console=False)

logger.configure(handlers=HANDLERS)


def get_logger(source):
    return logger.bind(source=source)

All this works, but I want to be able to pass logfire tags when I log using loguru like logging.info("", _tags=['my', 'logfire', 'tags'], is it possible to do that?

@satwikkansal satwikkansal added the Question Further information is requested label Oct 21, 2024
@alexmojaki
Copy link
Contributor

I was hoping logger.info('Hello, {name}!', name='World', **{'logfire.tags': ['foo', 'bar']}) would work, but we don't actually handle it properly.

@alexmojaki alexmojaki added bug Bug related to the Logfire Python SDK and removed Question Further information is requested labels Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug related to the Logfire Python SDK
Projects
None yet
Development

No branches or pull requests

2 participants