# ormaos logs

> Shows the logging records of a recording or a call, grouped by level, logger, template and line, also the ones the level of the logger dropped.

```text
ormaos logs [-h] [--json] [--limit N] [--offset N] [--level NAME]
            [--dropped]
            [address]
```

| Argument | From the parser | Default |
|---|---|---|
| `address` | `last` (the default), a recording such as r3, or an address inside one: r3:c42 (a call), r3:e5 (an exception), r3:i7 (an io event), r3:l2 (a logging record) | `last` |
| `--json` | print JSON on stdout. |  |
| `--limit N` | show at most N entries (default 20) | `20` |
| `--offset N` | skip the first N entries. |  |
| `--level NAME` | show only this level: DEBUG, INFO, WARNING, ERROR, CRITICAL. |  |
| `--dropped` | show only the records the level of the logger dropped. |  |

```console
$ ormaos logs r1
r1: 8 logging records (WARNING 6, INFO 2), 8 dropped by the level
  1x INFO order_sync "reading orders from %s"  dropped by the level  at job.py:44 in load_orders  [r1:l1]
  6x WARNING order_sync "order %s skipped: %s"  dropped by the level  at job.py:58 in sync_orders  [r1:l2]
  1x INFO order_sync "%d orders read, %d applied in this run"  dropped by the level  at job.py:80 in main  [r1:l3]
next: ormaos logs r1:l1 | ormaos logs r1:l2 | ormaos tree r1:c19 | ormaos exceptions r1
```

A record is seen where your code asks for it: `log.info(...)`, `logging.warning(...)`, `log.exception(...)`, `log.log(level, ...)`, a `LoggerAdapter`. `dropped by the level` means the level of the logger (or `logging.disable`) stopped the record before it was made, so no handler ever saw it. Records asked for in a row at the same line, with the same level and template, are one entry with a count.

The message template is recorded when it is a string written in the code of the caller (`"order %s skipped: %s"`). A message made at run time (an f-string, a concatenation) is a value: only its type and length are kept. The arguments and the formatted message are never recorded.

## Arguments

### `address`

A recording, a call (its records and those of the calls below it), an exception (the call that handled it), or one record:

```console
$ ormaos logs r1:l2
r1:l2 WARNING order_sync "order %s skipped: %s"  dropped by the level
  6 times in a row, at the same line
  asked at    job.py:58 in sync_orders  [r1:c130]
  inside      r1:c1 <module> > r1:c16 main
  outcome     dropped: the level of the logger did not let it through
  arguments   2, not recorded
next: ormaos logs r1:c130 | ormaos tree r1:c130 | ormaos logs r1
```

### `--level NAME`

Only one level: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`.

### `--dropped`

Only the records the level of the logger dropped.

### `--limit N`

At most N entries. Default 20.

### `--offset N`

Skips the first N entries.

### `--json`

Kinds `logs` and `log_record`. Schemas: [/schemas/logs.json](/schemas/logs.json), [/schemas/log_record.json](/schemas/log_record.json).

---

Source: https://docs.ormaos.com/python/reference/cli/logs/ · ormaos 0.0.1 · ormaos-python 968f69776c · ormaos-examples 6e27be5922
