Skip to content

Commit 8599a03

Browse files
Merge pull request #1446 from Bastian-Krause/bst/steplogger-improvements
StepLogger documentation and warning fix
2 parents 99edb4d + 2dd4034 commit 8599a03

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

doc/configuration.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3434,6 +3434,9 @@ Reporters
34343434

34353435
StepReporter
34363436
~~~~~~~~~~~~
3437+
.. warning::
3438+
The StepReporter is deprecated, use the `StepLogger`_ instead.
3439+
34373440
The :any:`StepReporter` outputs individual labgrid steps to `STDOUT`.
34383441

34393442
.. doctest::
@@ -3471,6 +3474,32 @@ The Reporter can be stopped with a call to the stop function:
34713474
Stopping the ConsoleLoggingReporter if it has not been started will raise an
34723475
AssertionError, as will starting an already started StepReporter.
34733476

3477+
Loggers
3478+
-------
3479+
3480+
StepLogger
3481+
~~~~~~~~~~
3482+
The :any:`StepLogger` logs individual labgrid steps.
3483+
3484+
Logging can be set up via ``labgrid.logging.basicConfig()``.
3485+
3486+
.. doctest::
3487+
3488+
>>> import logging
3489+
>>> from labgrid.logging import basicConfig, StepLogger
3490+
>>> basicConfig(level=logging.INFO)
3491+
>>> StepLogger.start()
3492+
3493+
The logger can be stopped with a call to the stop function:
3494+
3495+
.. doctest::
3496+
3497+
>>> from labgrid.logging import StepLogger
3498+
>>> StepLogger.stop()
3499+
3500+
Stopping the StepLogger if it has not been started will raise an
3501+
AssertionError, as will starting an already started StepLogger.
3502+
34743503
Environment Configuration
34753504
-------------------------
34763505
The environment configuration for a test environment consists of a YAML file

doc/development.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ Step Tracing
764764

765765
The Step infrastructure already collects timing and nesting information on
766766
executed commands, but is currently only used in the pytest plugin or via the
767-
standalone StepReporter.
767+
standalone StepLogger (or deprecated StepReporter).
768768
By writing these events to a file (or sqlite database) as a trace, we can
769769
collect data over multiple runs for later analysis.
770770
This would become more useful by passing recognized events (stack traces,

labgrid/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def __attrs_post_init__(self):
136136
from warnings import warn
137137

138138
warn(
139-
"StepLogger should not be instantiated, use StepReporter.start()/.stop() instead.",
139+
"StepLogger should not be instantiated, use StepLogger.start()/.stop() instead.",
140140
DeprecationWarning,
141141
stacklevel=2,
142142
)

0 commit comments

Comments
 (0)