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

# Log Objects

### Haiqu Log

#### Haiqu.log(parent\_ctx=None, child\_ctx=None, name=None, description=None)

Record data to the Haiqu cloud based on the context
(e.g., circuit, or any other relevant information).

This method functions similarly to a generic logger, in the same vein as
the log method of the Weights & Biases Python SDK for machine learning.

* **Parameters:**
  * **parent\_ctx** (*CircuitModel* *|* *QuantumCircuit* *|* *Any*) -- The input object to be logged.
  * **child\_ctx** (*Any*) -- An optional child object, linked to the context of the parent.
  * **name** (*str*) -- An optional name for the logged object.
  * **description** (*str*) -- An optional description if logging a circuit.
* **Returns:**
  Status message, circuit metadata.
* **Return type:**
  str | CircuitModel

#### Examples

If used without parameters, `haiqu.log()` displays the nice widget
with help. Try it out:

```python theme={null}
>>> haiqu.log()
```

This function always acts in the context of the current experiment.
If the circuit metadata object (CircuitModel) is passed as the first
argument, it will log data to that circuit.

#### Log metrics

```python theme={null}
>>> haiqu.log(12.34, name="Some value")
>>> haiqu.log("Hello quantum world!", name="Some textual value")
>>> haiqu.log([1, 2, 3], name="Experiment parameters")
>>> # W&B style:
>>> haiqu.log({"examples": ["one", "two", "three"]})
>>> haiqu.log({"some_value": 12.34, "some_text": "Quantum!", "parameters": [1, 2, 3]})
```

#### Log a circuit

```python theme={null}
>>> from qiskit.circuit.random import random_circuit
>>> qc = random_circuit(num_qubits=4, depth=1, max_operands=4, measure=True)
>>> meta = haiqu.log(qc)
>>> # or with name/description:
>>> meta = haiqu.log(qc, name="Hello", description="World!")
>>> # log artifact/metric to the circuit:
>>> haiqu.log(meta, 42)
```

#### Log the Matplotlib plt object

```python theme={null}
>>> import matplotlib.pyplot as plt
>>> plt.plot([1, 2, 3], [4, 5, 6], label="Label")
>>> haiqu.log(plt, name="Awesome plot")
>>> # or W&B style:
>>> # haiqu.log({"chart": plt})
```

#### Log the Pandas DataFrame

```python theme={null}
>>> import pandas as pd
>>> data = {
>>>     "columns": [0, 1, 2],
>>>     "data": [50, 40, 45]
>>> }
>>> df = pd.DataFrame(data)
>>> haiqu.log(df, name="My DataFrame")
```

#### Log the Drawer plot

```python theme={null}
>>> from haiqu.sdk.wiz.drawer import Drawer
>>> drawer = Drawer()
>>> drawer.plot([1, 2, 3], [4, 5, 6])
>>> haiqu.log(drawer, name="Cool drawer plot")
```

#### Log the Matplotlib figure

```python theme={null}
>>> import matplotlib.pyplot as plt
```

```python theme={null}
>>> fig, ax = plt.subplots()
>>> ax.plot([1, 2, 3], [4, 5, 6], label="Test Plot")
>>> ...
>>> haiqu.log(fig, name="Awesome figure")
```

You can see logged data on Dashboard: [https://dashboard.haiqu.ai](https://dashboard.haiqu.ai)
