MCPcopy Create free account
hub / github.com/hynek/structlog / ReturnLogger

Class ReturnLogger

src/structlog/testing.py:103–128  ·  view source on GitHub ↗

Return the arguments that it's called with. >>> from structlog import ReturnLogger >>> ReturnLogger().info("hello") 'hello' >>> ReturnLogger().info("hello", when="again") (('hello',), {'when': 'again'}) .. versionchanged:: 0.3.0 Allow for arbitrary arguments an

Source from the content-addressed store, hash-verified

101
102
103class ReturnLogger:
104 """
105 Return the arguments that it's called with.
106
107 >>> from structlog import ReturnLogger
108 >>> ReturnLogger().info("hello")
109 'hello'
110 >>> ReturnLogger().info("hello", when="again")
111 (('hello',), {'when': 'again'})
112
113 .. versionchanged:: 0.3.0
114 Allow for arbitrary arguments and keyword arguments to be passed in.
115 """
116
117 def msg(self, *args: Any, **kw: Any) -> Any:
118 """
119 Return tuple of ``args, kw`` or just ``args[0]`` if only one arg passed
120 """
121 # Slightly convoluted for backwards compatibility.
122 if len(args) == 1 and not kw:
123 return args[0]
124
125 return args, kw
126
127 log = debug = info = warn = warning = msg
128 fatal = failure = err = error = critical = exception = msg
129
130
131class ReturnLoggerFactory:

Callers 15

build_blFunction · 0.90
test_proxies_logMethod · 0.90
_loggerFunction · 0.90
test_return_loggerMethod · 0.90
test_cachesMethod · 0.90
test_pickleMethod · 0.90

Calls

no outgoing calls

Tested by 15

build_blFunction · 0.72
test_proxies_logMethod · 0.72
_loggerFunction · 0.72
test_return_loggerMethod · 0.72
test_cachesMethod · 0.72
test_pickleMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…