brk-code

structlog の API リファレンス

structlog (hynek/structlog) の公開 API 127 件 —— クラス 40、関数 27、メソッド 60。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: hynek/structlog

種別件数
クラス40
関数27
メソッド60

API 一覧

classsrc.structlog._base.BoundLoggerBase
Immutable context carrier.
methodsrc.structlog._base.BoundLoggerBase.bind(**new_values:Any) -> Self
Return a new logger with *new_values* added to the existing ones.
methodsrc.structlog._base.BoundLoggerBase.new(**new_values:Any) -> Self
Clear context and binds *new_values* using `bind`.
methodsrc.structlog._base.BoundLoggerBase.try_unbind(*keys:str) -> Self
Like :meth:`unbind`, but best effort: missing keys are ignored.
methodsrc.structlog._base.BoundLoggerBase.unbind(*keys:str) -> Self
Return a new logger with *keys* removed from the context.
funcsrc.structlog._base.get_context(bound_logger:BindableLogger) -> Context
Return *bound_logger*'s context.
classsrc.structlog._config.BoundLoggerLazyProxy
Instantiates a bound logger on first usage.
methodsrc.structlog._config.BoundLoggerLazyProxy.bind(**new_values:Any) -> BindableLogger
Assemble a new BoundLogger from arguments and configuration.
funcsrc.structlog._config.BoundLoggerLazyProxy.finalized_bind(**new_values:Any) -> BindableLogger
Use cached assembled logger to bind potentially new values.
methodsrc.structlog._config.BoundLoggerLazyProxy.new(**new_values:Any) -> BindableLogger
Clear context, then bind.
methodsrc.structlog._config.BoundLoggerLazyProxy.unbind(*keys:str) -> BindableLogger
Same as bind, except unbind *keys* first.
funcsrc.structlog._config.get_config() -> dict[str, Any]
Get a dictionary with the current configuration.
funcsrc.structlog._config.get_logger(*args:Any, **initial_values:Any) -> Any
Convenience function that returns a logger according to configuration.
funcsrc.structlog._config.is_configured() -> bool
Return whether *structlog* has been configured.
funcsrc.structlog._config.reset_defaults() -> None
Resets global default values to builtin defaults.
classsrc.structlog._generic.BoundLogger
A generic BoundLogger that can wrap anything.
classsrc.structlog._greenlets.GreenThreadLocal
threading.local() replacement for greenlets.
funcsrc.structlog._native.aexception(self:FilteringBoundLogger, event:str, *args:Any, **kw:Any) -> Any
..
funcsrc.structlog._native.alog(self:Any, level:int, event:str, *args:Any, **kw:Any) -> Any
..
funcsrc.structlog._native.ameth(self:Any, event:str, *args:Any, **kw:Any) -> Any
..
classsrc.structlog._output.BytesLogger
Writes bytes into a file.
methodsrc.structlog._output.BytesLogger.msg(message:bytes) -> None
Write *message*.
classsrc.structlog._output.BytesLoggerFactory
Produce `BytesLogger`\ s.
classsrc.structlog._output.PrintLogger
Print events into a file.
methodsrc.structlog._output.PrintLogger.msg(message:str) -> None
Print *message*.
classsrc.structlog._output.PrintLoggerFactory
Produce `PrintLogger`\ s.
classsrc.structlog._output.WriteLogger
Write events into a file.
methodsrc.structlog._output.WriteLogger.msg(message:str) -> None
Write and flush *message*.
classsrc.structlog._output.WriteLoggerFactory
Produce `WriteLogger`\ s.
funcsrc.structlog.contextvars.bind_contextvars(**kw:Any) -> Mapping[str, contextvars.Token[Any]]
Put keys and values into the context-local context.
funcsrc.structlog.contextvars.bound_contextvars(**kw:Any) -> Generator[None, None, None]
Bind *kw* to the current context-local context.
funcsrc.structlog.contextvars.clear_contextvars() -> None
Clear the context-local context.
funcsrc.structlog.contextvars.reset_contextvars(**kw:contextvars.Token[Any]) -> None
Reset contextvars corresponding to the given Tokens.
funcsrc.structlog.contextvars.unbind_contextvars(*keys:str) -> None
Remove *keys* from the context-local context if they are present.
classsrc.structlog.dev.ColumnFormatter
:class:`~typing.Protocol` for column formatters.
classsrc.structlog.dev.ColumnStyles
Column styles settings for console rendering.
classsrc.structlog.dev.KeyValueColumnFormatter
Format a key-value pair.
classsrc.structlog.dev.LogLevelColumnFormatter
Format a log level according to *level_styles*.
classsrc.structlog.dev.RichTracebackFormatter
A Rich traceback renderer with the given options.
funcsrc.structlog.dev.plain_traceback(sio:TextIO, exc_info:ExcInfo) -> None
"Pretty"-print *exc_info* to *sio* using our own plain formatter.
classsrc.structlog.exceptions.DropEvent
If raised by an processor, the event gets silently dropped.
classsrc.structlog.processors.EventRenamer
Rename the ``event`` key in event dicts.
classsrc.structlog.processors.LogfmtRenderer
Render ``event_dict`` using the logfmt_ format.
classsrc.structlog.processors.MaybeTimeStamper
A timestamper that only adds a timestamp if there is none.
classsrc.structlog.processors.TimeStamper
Add a timestamp to ``event_dict``.
classsrc.structlog.processors.UnicodeDecoder
Decode byte string values in ``event_dict``.
classsrc.structlog.processors.UnicodeEncoder
Encode unicode values in ``event_dict``.
classsrc.structlog.stdlib.BoundLogger
Python Standard Library version of `structlog.BoundLogger`.
methodsrc.structlog.stdlib.BoundLogger.acritical(event:str, *args:Any, **kw:Any) -> None
Log using `critical()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.addHandler(hdlr:logging.Handler) -> None
Calls :meth:`logging.Logger.addHandler` with unmodified arguments.
methodsrc.structlog.stdlib.BoundLogger.adebug(event:str, *args:Any, **kw:Any) -> None
Log using `debug()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.aerror(event:str, *args:Any, **kw:Any) -> None
Log using `error()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.afatal(event:str, *args:Any, **kw:Any) -> None
Log using `critical()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.ainfo(event:str, *args:Any, **kw:Any) -> None
Log using `info()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.alog(level:Any, event:str, *args:Any, **kw:Any) -> None
Log using `log()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.awarning(event:str, *args:Any, **kw:Any) -> None
Log using `warning()`, but asynchronously in a separate thread.
methodsrc.structlog.stdlib.BoundLogger.bind(**new_values:Any) -> Self
Return a new logger with *new_values* added to the existing ones.
methodsrc.structlog.stdlib.BoundLogger.debug(event:str | None=None, *args:Any, **kw:Any) -> Any
Process event and call `logging.Logger.debug` with the result.
methodsrc.structlog.stdlib.BoundLogger.disabled() -> int
Returns :attr:`logging.Logger.disabled`
methodsrc.structlog.stdlib.BoundLogger.error(event:str | None=None, *args:Any, **kw:Any) -> Any
Process event and call `logging.Logger.error` with the result.
methodsrc.structlog.stdlib.BoundLogger.getChild(suffix:str) -> logging.Logger
Calls :meth:`logging.Logger.getChild` with unmodified arguments.
methodsrc.structlog.stdlib.BoundLogger.handle(record:logging.LogRecord) -> None
Calls :meth:`logging.Logger.handle` with unmodified arguments.
methodsrc.structlog.stdlib.BoundLogger.handlers() -> Any
Returns :attr:`logging.Logger.handlers`
methodsrc.structlog.stdlib.BoundLogger.info(event:str | None=None, *args:Any, **kw:Any) -> Any
Process event and call `logging.Logger.info` with the result.
methodsrc.structlog.stdlib.BoundLogger.isEnabledFor(level:int) -> bool
Calls :meth:`logging.Logger.isEnabledFor` with unmodified arguments.
methodsrc.structlog.stdlib.BoundLogger.level() -> int
Returns :attr:`logging.Logger.level`
methodsrc.structlog.stdlib.BoundLogger.name() -> str
Returns :attr:`logging.Logger.name`
methodsrc.structlog.stdlib.BoundLogger.new(**new_values:Any) -> Self
Clear context and binds *initial_values* using `bind`.
methodsrc.structlog.stdlib.BoundLogger.parent() -> Any
Returns :attr:`logging.Logger.parent`
methodsrc.structlog.stdlib.BoundLogger.propagate() -> bool
Returns :attr:`logging.Logger.propagate`
methodsrc.structlog.stdlib.BoundLogger.setLevel(level:int) -> None
Calls :meth:`logging.Logger.setLevel` with unmodified arguments.
methodsrc.structlog.stdlib.BoundLogger.try_unbind(*keys:str) -> Self
Like :meth:`unbind`, but best effort: missing keys are ignored.
methodsrc.structlog.stdlib.BoundLogger.unbind(*keys:str) -> Self
Return a new logger with *keys* removed from the context.
classsrc.structlog.stdlib.LoggerFactory
Build a standard library logger when an *instance* is called.
classsrc.structlog.stdlib.PositionalArgumentsFormatter
Apply stdlib-like string formatting to the ``event`` key.
classsrc.structlog.stdlib.ProcessorFormatter
Call *structlog* processors on `logging.LogRecord`\s.
funcsrc.structlog.stdlib.add_log_level_number(logger:logging.Logger, method_name:str, event_dict:EventDict) -> EventDict
Add the log level number to the event dict.
funcsrc.structlog.stdlib.add_logger_name(logger:logging.Logger, method_name:str, event_dict:EventDict) -> EventDict
Add the logger name to the event dict.
funcsrc.structlog.stdlib.recreate_defaults(*log_level:int | None=logging.NOTSET) -> None
Recreate defaults on top of standard library's logging.
classsrc.structlog.testing.CapturedCall
A call as captured by `CapturingLogger`.
classsrc.structlog.testing.CapturingLogger
Store the method calls that it's been called with.
classsrc.structlog.testing.CapturingLoggerFactory
Produce and cache `CapturingLogger`\ s.
classsrc.structlog.testing.LogCapture
Class for capturing log messages in its entries list.
classsrc.structlog.testing.ReturnLogger
Return the arguments that it's called with.
classsrc.structlog.testing.ReturnLoggerFactory
Produce and cache `ReturnLogger`\ s.
funcsrc.structlog.threadlocal.bind_threadlocal(**kw:Any) -> None
Put keys and values into the thread-local context.
funcsrc.structlog.threadlocal.bound_threadlocal(**kw:Any) -> Generator[None, None, None]
Bind *kw* to the current thread-local context.
funcsrc.structlog.threadlocal.clear_threadlocal() -> None
Clear the thread-local context.
funcsrc.structlog.threadlocal.get_threadlocal() -> Context
Return a copy of the current thread-local context.
funcsrc.structlog.threadlocal.tmp_bind(logger:TLLogger, **tmp_values:Any) -> Generator[TLLogger, None, None]
Bind *tmp_values* to *logger* & memorize current state.
funcsrc.structlog.threadlocal.wrap_dict(dict_class:type[Context]) -> type[Context]
Wrap a dict-like class and return the resulting class.
classsrc.structlog.tracebacks.Frame
Represents a single stack frame.
classsrc.structlog.tracebacks.Stack
Represents an exception and a list of stack frames.
classsrc.structlog.tracebacks.Trace
Container for a list of stack traces.
funcsrc.structlog.tracebacks.get_locals(iter_locals:Iterable[tuple[str, object]]) -> Iterable[tuple[str, object]]
Extract locals from an iterator of key pairs.
funcsrc.structlog.tracebacks.safe_str(_object:Any) -> str
Don't allow exceptions from __str__ to propagate.
funcsrc.structlog.tracebacks.to_repr(obj:Any, max_length:int | None=None, max_string:int | None=None, use_rich:bool=True) -> str
Get repr string for an object, but catch errors.
classsrc.structlog.twisted.BoundLogger
Twisted-specific version of `structlog.BoundLogger`.
methodsrc.structlog.twisted.BoundLogger.err(event:str | None=None, **kw:Any) -> Any
Process event and call ``log.err()`` with the result.
methodsrc.structlog.twisted.BoundLogger.msg(event:str | None=None, **kw:Any) -> Any
Process event and call ``log.msg()`` with the result.
classsrc.structlog.twisted.EventAdapter
Adapt an ``event_dict`` to Twisted logging system.
classsrc.structlog.twisted.LoggerFactory
Build a Twisted logger when an *instance* is called.
classsrc.structlog.twisted.ReprWrapper
Wrap a string and return it as the ``__repr__``.
classsrc.structlog.typing.FilteringBoundLogger
**Protocol**: A `BindableLogger` that filters by a level.
methodsrc.structlog.typing.FilteringBoundLogger.acritical(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **critical** level.
methodsrc.structlog.typing.FilteringBoundLogger.adebug(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **debug** level.
methodsrc.structlog.typing.FilteringBoundLogger.aerror(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **error** level.
methodsrc.structlog.typing.FilteringBoundLogger.afatal(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **critical** level.
methodsrc.structlog.typing.FilteringBoundLogger.ainfo(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **info** level.
methodsrc.structlog.typing.FilteringBoundLogger.alog(level:int, event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at *level*.
methodsrc.structlog.typing.FilteringBoundLogger.amsg(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **info** level.
methodsrc.structlog.typing.FilteringBoundLogger.awarn(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **warn** level.
methodsrc.structlog.typing.FilteringBoundLogger.awarning(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **warn** level.
methodsrc.structlog.typing.FilteringBoundLogger.critical(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **critical** level.
methodsrc.structlog.typing.FilteringBoundLogger.debug(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **debug** level.
methodsrc.structlog.typing.FilteringBoundLogger.err(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **error** level.
methodsrc.structlog.typing.FilteringBoundLogger.error(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **error** level.
methodsrc.structlog.typing.FilteringBoundLogger.fatal(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **critical** level.
methodsrc.structlog.typing.FilteringBoundLogger.get_effective_level() -> int
Return the effective level of the logger.
methodsrc.structlog.typing.FilteringBoundLogger.info(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **info** level.
methodsrc.structlog.typing.FilteringBoundLogger.is_enabled_for(level:int) -> bool
Check whether the logger is enabled for *level*.
methodsrc.structlog.typing.FilteringBoundLogger.log(level:int, event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at *level*.
methodsrc.structlog.typing.FilteringBoundLogger.msg(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **info** level.
methodsrc.structlog.typing.FilteringBoundLogger.new(**new_values:Any) -> FilteringBoundLogger
Clear context and binds *initial_values* using `bind`.
methodsrc.structlog.typing.FilteringBoundLogger.unbind(*keys:str) -> FilteringBoundLogger
Return a new logger with *keys* removed from the context.
methodsrc.structlog.typing.FilteringBoundLogger.warn(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **warn** level.
methodsrc.structlog.typing.FilteringBoundLogger.warning(event:str, *args:Any, **kw:Any) -> Any
Log ``event % args`` with **kw** at **warn** level.

この情報について

掲載しているシグネチャは hynek/structlog の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る