---
title: Logger
description: Base class for experiment loggers.
canonical: >-
  https://lightning.ai/docs/fabric/stable/full-api-reference/api/generated/lightning.fabric.loggers.Logger
---
# Logger {#logger}

### `class lightning.fabric.loggers.Logger` {#lightning.fabric.loggers.Logger}

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC "(in Python v3.15)")

Base class for experiment loggers.

#### `finalize(status)` {#lightning.fabric.loggers.Logger.finalize}

Do any processing that is necessary to finalize an experiment.

Parameters:

**status** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) – Status that the experiment finished with (e.g. success, failed, aborted)

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `log_graph(model, input_array=None)` {#lightning.fabric.loggers.Logger.log_graph}

Record model graph.

Parameters:

*   **model** ([`Module`](https://docs.pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module "(in PyTorch v2.15)")) – the model with an implementation of `forward`.
    
*   **input\_array** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")\]) – input passes to model.forward
    

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `abstract log_hyperparams(params, *args, **kwargs)` {#lightning.fabric.loggers.Logger.log_hyperparams}

Record hyperparameters.

Parameters:

*   **params** (`Union`\[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")\], [`Namespace`](https://docs.python.org/3/library/argparse.html#argparse.Namespace "(in Python v3.15)")\]) – [`Namespace`](https://docs.python.org/3/library/argparse.html#argparse.Namespace "(in Python v3.15)") or Dict containing the hyperparameters
    
*   **args** ([`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")) – Optional positional arguments, depends on the specific logger being used
    
*   **kwargs** ([`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")) – Optional keyword arguments, depends on the specific logger being used
    

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `abstract log_metrics(metrics, step=None)` {#lightning.fabric.loggers.Logger.log_metrics}

Records metrics. This method logs metrics as soon as it received them.

Parameters:

*   **metrics** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"), [`float`](https://docs.python.org/3/builtins/functions.html#float "(in Python v3.15)")\]) – Dictionary with metric names as keys and measured quantities as values
    
*   **step** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")\]) – Step number at which the metrics should be recorded
    

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `save()` {#lightning.fabric.loggers.Logger.save}

Save log data.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `property group_separator: str` {#lightning.fabric.loggers.Logger.group_separator}

Return the default separator used by the logger to group the data into subfolders.

#### `property log_dir: Optional[str]` {#lightning.fabric.loggers.Logger.log_dir}

Return directory the current version of the experiment gets saved, or None if the logger does not save data locally.

#### `abstract property name: Optional[str]` {#lightning.fabric.loggers.Logger.name}

Return the experiment name.

#### `property root_dir: Optional[str]` {#lightning.fabric.loggers.Logger.root_dir}

Return the root directory where all versions of an experiment get saved, or None if the logger does not save data locally.

#### `abstract property version: Optional[Union[int, str]]` {#lightning.fabric.loggers.Logger.version}

Return the experiment version.

---

**Navigation**

- Parent: [Generated](/docs/fabric/2.6.6/full-api-reference/api/generated.md)
