> ## Documentation Index
> Fetch the complete documentation index at: https://www.getmaxim.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# decorators.Trace

> Trace utilities for decorators for automatic logging and instrumentation of functions and methods.

[View module source on GitHub](https://github.com/maximhq/maxim-py/blob/main/maxim/decorators/trace.py)

#### current\_logger

```python theme={null}
def current_logger() -> Optional[Logger]
```

Get the current logger from the context variable.

#### current\_trace

```python theme={null}
def current_trace() -> Optional[Trace]
```

Get the current trace from the context variable.

#### trace

```python theme={null}
def trace(logger: Logger,
          id: Optional[Union[str, Callable]] = None,
          sessionId: Optional[Union[str, Callable]] = None,
          name: Optional[str] = None,
          tags: Optional[dict] = None,
          evaluators: Optional[List[str]] = None,
          evaluator_variables: Optional[Dict[str, str]] = None)
```

Decorator for tracking traces.

This decorator wraps functions to automatically create and manage [Trace](/sdk/python/references/logger/components/trace)
objects for tracking trace operations, including inputs, outputs, and metadata.
The decorated function must be called within a @trace or @span decorated context.
