Log Levels
Traces can have a lot of observations (data model). You can differentiate the importance of observations with the level
attribute to control the verbosity of your traces and highlight errors and warnings. Available levels
: DEBUG
, DEFAULT
, WARNING
, ERROR
.
In addition to the level, you can also include a statusMessage
to provide additional context.
When using the @observe()
decorator:
from langfuse.decorators import langfuse_context, observe
@observe()
def fn():
langfuse_context.update_current_observation(
level="WARNING",
status_message="This is a warning"
)
# outermost function becomes the trace, level and status message are only available on observations
@observe()
def main():
fn()
main()
When using the low-level SDK:
from langfuse import Langfuse
langfuse = Langfuse()
trace = langfuse.trace()
# Add an observation (span) with a level and status message
trace.span(
level="WARNING",
status_message="This is a warning"
)
GitHub Discussions
How to change the Level to ERROR when there is an error in SPAN?How to change the level of a trace?Filter by error in sub span
- 3votesHow to change the Level to ERROR when there is an error in SPAN?kftam1994•8/26/2024•2Resolved
- 3votesHow to change the level of a trace?ldbolanos•8/9/2024•2Resolved
Discussions last updated: 12/21/2024, 12:16:39 AM (3436 hours ago)
Last updated on