-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And refactor existing logging code to be more standard
- Loading branch information
1 parent
541ec39
commit dbabef2
Showing
26 changed files
with
305 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
# Logging | ||
To invoke the `ibex_bluesky_core` logger, create and use a `logger` object in [the standard way](https://docs.python.org/3/library/logging.html): | ||
|
||
To invoke the bluesky logger, import and use it at the desired level: | ||
```python | ||
from ibex_bluesky_core.logger import logger | ||
logger.blueskylogger.warning("Message to be logged") | ||
import logging | ||
logger = logging.getLogger(__name__) | ||
logger.warning("Message to be logged") | ||
``` | ||
The logger utilizes a `TimedRotatingFileHandler` defined in the `logging.conf` file that rolls over the log at midnight. | ||
|
||
The default logging level is defined at `INFO`. This means that events of lesser severity will not be logged. To change the default level, change level attribute of logger_blueskycore in the `logging.conf` | ||
The logger utilizes a `TimedRotatingFileHandler` defined in `ibex_bluesky_core.log` that rolls over the log at midnight. | ||
|
||
By default, the log files will be created in `c:\instrument\var\logs\bluesky`. This can be configured by setting | ||
the `IBEX_BLUESKY_CORE_LOGS` environment variable. | ||
|
||
There are 3 primary logger objects which are "interesting" in the context of `ibex_bluesky_core`: | ||
- `ibex_bluesky_core` itself | ||
- `bluesky`, for low-level diagnostic logging from the run engine & plans | ||
- `ophyd_async` for low-level diagnostic logging from ophyd-async devices | ||
|
||
The default logging level for bluesky libraries is defined at `INFO`. This means that events of lesser severity will not be logged. | ||
To change the logging level for all bluesky libraries simultaneously, call: | ||
|
||
```python | ||
from ibex_bluesky_core.log import set_bluesky_log_levels | ||
set_bluesky_log_levels("DEBUG") | ||
``` | ||
|
||
To change the logging level of just a single library (for example, just `opyhyd_async`), use the standard | ||
python `logging` mechanisms: | ||
|
||
```python | ||
import logging | ||
logging.getLogger("ophyd_async").setLevel("DEBUG") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
"""Common plans and devices for use across beamlines.""" | ||
"""Top-level ibex_bluesky_core module.""" | ||
|
||
from ibex_bluesky_core.log import setup_logging | ||
|
||
__all__ = [] | ||
|
||
setup_logging() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
"""For callbacks that relate to the BlueSky run engine.""" | ||
"""Bluesky callbacks which may be attached to the RunEngine.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.