Get granular control over logging with the GalileoLogger class
GalileoLogger
class provides the most granular control over logging in Galileo. You can create a logger yourself, or use one from the current context from inside a decorated or wrapped function or when using a third-party SDK integration.
GalileoLogger
class allows you to:
GalileoLogger
Python class.GalileoLogger
TypeScript class.GalileoLogger
to log an LLM call:
GalileoLogger
Python SDK docs or TypeScript SDK docs for more details.
@log
decorator, wrapped in the TypeScript log
wrapper, or created automatically by an experiment, then this will return that logger instance so you can manually add additional spans.
galileo_context
Python SDK docs or getLogger
TypeScript SDK docs for more details.
start_session
Python SDK docs or startSession
TypeScript SDK docs for more details.
set_session
Python SDK docs or setSession
TypeScript SDK docs for more details.
You can also continue a conversation using an external ID using the start session function.
clear_session
Python SDK docs or clearSession
TypeScript SDK docs for more details.
start_trace
Python SDK docs or startTrace
TypeScript SDK docs for more details.
GalileoLogger
supports adding different types of spans to your traces. All spans take the input and output, as well as a name, duration, tags, and other metadata.
Span Type | Description |
---|---|
Agent | A span for logging agent actions. You can specify the agent type, for example a supervisor, planner, router, or judge. |
LLM | A span for logging calls to an LLM. You can specify the number of tokens, time to first token, temperature, model, and any tools. |
Retriever | A span for logging RAG actions. In the output for this span you can provide all the data returned from the RAG platform for evaluating your RAG processing, |
Tool | A span for logging calls to tools. You can specify the tool call ID to tie to an LLM tool call. |
Workflow | Workflow spans are for creating logical groupings of spans based on different flows in your app. |
add_agent_span
Python SDK docs or addAgentSpan
TypeScript SDK docs for more details.
add_llm_span
Python SDK docs or addLlmSpan
TypeScript SDK docs for more details.
add_retriever_span
Python SDK docs or addRetrieverSpan
TypeScript SDK docs for more details.
add_tool_span
Python SDK docs or addToolSpan
TypeScript SDK docs for more details.
add_workflow_span
Python SDK docs or addWorkflowSpan
TypeScript SDK docs for more details.
conclude
Python SDK docs or conclude
TypeScript SDK docs for more details.
flush
Python SDK docs or flush
TypeScript SDK docs for more details.
The flush call on the logger will just flush that specific logger. To flush all loggers, you can flush at the context level.
add_single_llm_span_trace
Python SDK docs or addSingleLlmSpanTrace
TypeScript SDK docs for more details.
@log
decorator and wrappers are easier to use and less error-prone.flush()
at the end of a request or user interaction to ensure data is sent to Galileo.