File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 66
77from fastcs .attribute_io_ref import AttributeIORefT
88from fastcs .datatypes import ATTRIBUTE_TYPES , DataType , T
9- from fastcs .logging import logger as _logger
9+ from fastcs .logging import bind_logger
1010from fastcs .tracer import Tracer
1111
1212ONCE = float ("inf" )
1313"""Special value to indicate that an attribute should be updated once on start up."""
1414
15- logger = _logger . bind (logger_name = __name__ )
15+ logger = bind_logger (logger_name = __name__ )
1616
1717
1818class Attribute (Generic [T , AttributeIORefT ], Tracer ):
Original file line number Diff line number Diff line change 77from ._graylog import GraylogStaticFields as GraylogStaticFields
88from ._graylog import parse_graylog_env_fields as parse_graylog_env_fields
99from ._graylog import parse_graylog_static_fields as parse_graylog_static_fields
10- from ._logging import LogLevel , _configure_logger
10+ from ._logging import Logger , LogLevel , _configure_logger
1111
1212logger = _logger .bind (logger_name = "fastcs" )
1313"""FastCS logger
5050fastcs. Instead there is a ``Tracer`` class for verbose logging with fine-grained
5151controls that can be enabled by the user at runtime.
5252
53- Use ``configure_logging`` to re-confi the logger at runtime. For more advanced
53+ Use ``configure_logging`` to re-configure the logger at runtime. For more advanced
5454controls, configure the ``logger`` singleton directly.
5555
5656See the ``loguru`` docs for more information: https://loguru.readthedocs.io
5757"""
5858
5959
60+ def bind_logger (logger_name : str ) -> Logger :
61+ """Create a wrapper of the singleton fastcs logger with the given name bound
62+
63+ The name will be displayed in all log messages from the returned wrapper.
64+
65+ See the docstring for ``fastcs.logging.logger`` for more information.
66+
67+ """
68+
69+ return logger .bind (logger_name = logger_name )
70+
71+
6072def configure_logging (
6173 level : LogLevel | None = None ,
6274 graylog_endpoint : GraylogEndpoint | None = None ,
Original file line number Diff line number Diff line change 1010from fastcs .controller_api import ControllerAPI
1111from fastcs .cs_methods import Command
1212from fastcs .datatypes import DataType , T
13- from fastcs .logging import logger as _logger
13+ from fastcs .logging import bind_logger
1414from fastcs .tracer import Tracer
1515from fastcs .transport .epics .ca .util import (
1616 builder_callable_from_attribute ,
2727
2828
2929tracer = Tracer (name = __name__ )
30- logger = _logger . bind (logger_name = __name__ )
30+ logger = bind_logger (logger_name = __name__ )
3131
3232
3333class EpicsCAIOC :
You can’t perform that action at this time.
0 commit comments