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

Use structlog and enable persisting logs in JSONL format #332

Merged
merged 6 commits into from
May 7, 2024

Conversation

bakar-io
Copy link
Contributor

@bakar-io bakar-io commented May 6, 2024

In addition to streaming logs to the console (as it was happening before), logs are now also saved to a rotated file locally. These logs are in JSONL format.

Both of the following are valid and work as expected.

import structlog

logger = structlog.get_logger(__name__)
logger.info("Hello", foo="bar")
import logging

logger = logging.getLogger(__name__)
logger.info("Hello", extra={"foo": "bar"})

Here's what gets stored in a log file: {"message": "Hello", "foo": "bar", "logger": "app.api.assistants", "level": "info", "timestamp": "2024-05-06T10:58:05.144324Z"}. Console simply displays Hello (as it would have done before this PR).

@nfcampos nfcampos merged commit 3b2f20a into langchain-ai:main May 7, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants