Skip to content

Commit 29245ed

Browse files
committed
Update tutorial and references
1 parent cafe64f commit 29245ed

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

docs/how-to/use-handlers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Remember that by default, any messages received by the logger will be transmitte
88

99
**In the future, this will be automatically generated from the docstrings.**
1010

11-
For the full API reference (kwargs, types, defaults), see the [auto-generated reference](../reference/).
11+
For the full API reference (kwargs, types, defaults), see the [auto-generated reference](https://dune-daq.github.io/daqpytools/APIref).
1212

1313
---
1414

docs/tutorial.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Getting Started with Logging in DUNE-DAQ
22

3-
This is a very quick tutorial for someone entirely new to logging.
4-
5-
**NEED TO WRITE THE TUTORIAL HEREE**. still a wip
6-
7-
<!-- YOU SHOULD WRITE A BRIEF INTRO HERE: one paragraph orienting a brand new user to what they will accomplish by the end of this tutorial (e.g. "By the end of this page you will have a working logger printing coloured output to your terminal"). Keep it concrete and task-focused. -->
3+
By the end of this tutorial you will have a working logger printing colour-formatted output to your terminal. It should take about five minutes. No prior knowledge of Python logging is assumed — if you want to understand the concepts behind what you're doing, read [Concepts & explanation](./explanation.md) afterwards.
84

95
## Prerequisites
106

11-
<!-- YOU SHOULD WRITE ABOUT: what the reader needs before starting — DUNE environment loaded, daqpytools installed, etc. -->
7+
Before starting, make sure you have:
8+
9+
- The DUNE DAQ environment loaded (i.e. `dbt-setup-env` or equivalent has been run in your shell)
10+
- `daqpytools` installed in your environment
1211

1312
## Step 1: Initialize a logger
1413

@@ -29,6 +28,8 @@ test_logger = get_daq_logger(
2928

3029
For now, **please see the docstring of `get_daq_logger` to see what stuff you can have and what to initialise with.**
3130

31+
This gives you a named logger with a single Rich handler attached, emitting at `INFO` level and above. Loggers in daqpytools are singletons — calling `get_daq_logger` with the same name twice will return the same instance, so it's safe to call this once at module level and reuse it throughout your code.
32+
3233
## Step 2: Emit your first messages
3334

3435
```python
@@ -43,19 +44,20 @@ test_logger.info(
4344
)
4445
```
4546

46-
## Step 3: Explore with the logging demonstrator
47+
You should see colour-formatted output in your terminal, something like this:
4748

48-
A lot of the available features can be demonstrated via the logging demonstrator functionality. With the DUNE environments loaded, simply run:
49-
50-
```
51-
daqpytools-logging-demonstrator
52-
```
49+
![rich_demo](img/demo_rich.png)
5350

54-
and view the help string to learn more, and view the script itself in the repository to see how it is implemented.
51+
The Rich handler supports the full [Rich markup syntax](https://rich.readthedocs.io/en/stable/markup.html) inline in your log messages.
5552

5653
## Next steps
5754

55+
- To explore the full range of available handlers and filters interactively, run the logging demonstrator with the DUNE environments loaded:
56+
```
57+
daqpytools-logging-demonstrator
58+
```
59+
View the help string to learn more, and the script itself in the repository to see how it is implemented.
5860
- To understand *why* logging works the way it does, read the [Concepts & explanation](./explanation.md).
5961
- To learn how to use specific handlers and filters, see the [How-to guides](./how-to/).
60-
- For a full API reference, see the [Reference](./reference/).
62+
- For a full API reference, see the [API Ref](https://dune-daq.github.io/daqpytools/APIref).
6163
- If you are introducing logging to your Python repo, or upgrading an existing implementation, **please** read the [Logging best practices](./how-to/best-practices.md).

docs_dev/explanation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ Defined in `specs.py`, there are two types:
9999

100100
Specs are the "source of truth" for what a handler or filter is. When setup code needs to build something, it looks up the spec in a registry.
101101

102-
![Specs](../img/Specs_class.png)
102+
![Specs](img/Specs_class.png)
103103

104104
### HandleIDFilter
105105

106-
![Filtering](../img/Filter_class.png)
106+
![Filtering](img/Filter_class.png)
107107

108108
`HandleIDFilter` is the core enforcement mechanism. Each handler gets one attached to it.
109109

@@ -223,4 +223,4 @@ DUNEDAQ_ERS_WARNING="..."
223223

224224
These are parsed into `ERSPyLogHandlerConf` objects that hold the handler list and optional protobuf endpoint for each severity.
225225

226-
![LogHandlerConf](../img/LHC_class.png)
226+
![LogHandlerConf](img/LHC_class.png)

0 commit comments

Comments
 (0)