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"
)