logbook-stubs 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
.vscode
|
|
114
|
+
.helix
|
|
115
|
+
|
|
116
|
+
# Spyder project settings
|
|
117
|
+
.spyderproject
|
|
118
|
+
.spyproject
|
|
119
|
+
|
|
120
|
+
# Rope project settings
|
|
121
|
+
.ropeproject
|
|
122
|
+
|
|
123
|
+
# mkdocs documentation
|
|
124
|
+
/site
|
|
125
|
+
|
|
126
|
+
# mypy
|
|
127
|
+
.mypy_cache/
|
|
128
|
+
.dmypy.json
|
|
129
|
+
dmypy.json
|
|
130
|
+
|
|
131
|
+
# Pyre type checker
|
|
132
|
+
.pyre/
|
|
133
|
+
|
|
134
|
+
examples/*.service
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from logbook.base import (
|
|
4
|
+
CRITICAL as CRITICAL,
|
|
5
|
+
DEBUG as DEBUG,
|
|
6
|
+
ERROR as ERROR,
|
|
7
|
+
INFO as INFO,
|
|
8
|
+
NOTICE as NOTICE,
|
|
9
|
+
NOTSET as NOTSET,
|
|
10
|
+
TRACE as TRACE,
|
|
11
|
+
WARNING as WARNING,
|
|
12
|
+
Logger as Logger,
|
|
13
|
+
LoggerGroup as LoggerGroup,
|
|
14
|
+
LogLevel as LogLevel,
|
|
15
|
+
LogRecord as LogRecord,
|
|
16
|
+
Processor as Processor,
|
|
17
|
+
)
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections import defaultdict
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from types import FrameType, TracebackType
|
|
6
|
+
from typing import TYPE_CHECKING, Callable, Literal, TypeAlias
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from logbook.handlers import Handler
|
|
10
|
+
|
|
11
|
+
from _typeshed import Incomplete
|
|
12
|
+
|
|
13
|
+
StringLevel: TypeAlias = Literal['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTICE', 'TRACE', 'NOTSET']
|
|
14
|
+
# Need to keep in sync with the constansts from logbook.base
|
|
15
|
+
NumericLevel: TypeAlias = Literal[15, 14, 13, 12, 11, 10, 9, 0]
|
|
16
|
+
LogLevel: TypeAlias = StringLevel | NumericLevel
|
|
17
|
+
|
|
18
|
+
# Level constants
|
|
19
|
+
CRITICAL: Literal[15] = 15
|
|
20
|
+
ERROR: Literal[14] = 14
|
|
21
|
+
WARNING: Literal[13] = 13
|
|
22
|
+
INFO: Literal[12] = 12
|
|
23
|
+
DEBUG: Literal[11] = 11
|
|
24
|
+
NOTICE: Literal[10] = 10
|
|
25
|
+
TRACE: Literal[9] = 9
|
|
26
|
+
NOTSET: Literal[0] = 0
|
|
27
|
+
|
|
28
|
+
_ExcInfo = tuple[type[BaseException], BaseException, TracebackType] | tuple[None, None, None]
|
|
29
|
+
|
|
30
|
+
class LogRecord:
|
|
31
|
+
channel: str
|
|
32
|
+
msg: str
|
|
33
|
+
args: tuple[Incomplete, ...]
|
|
34
|
+
kwargs: dict[str, Incomplete]
|
|
35
|
+
level: LogLevel
|
|
36
|
+
exc_info: _ExcInfo | Literal[True] | None
|
|
37
|
+
extra: defaultdict[str, Incomplete]
|
|
38
|
+
frame: FrameType | None
|
|
39
|
+
frame_correction: int
|
|
40
|
+
process: int | None
|
|
41
|
+
time: datetime | None
|
|
42
|
+
keep_open: bool
|
|
43
|
+
heavy_initialized: bool
|
|
44
|
+
late: bool
|
|
45
|
+
information_pulled: bool
|
|
46
|
+
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
channel: str,
|
|
50
|
+
level: int | StringLevel,
|
|
51
|
+
msg: str,
|
|
52
|
+
args: tuple[Incomplete, ...] | None = ...,
|
|
53
|
+
kwargs: dict[str, Incomplete] | None = ...,
|
|
54
|
+
exc_info: _ExcInfo | Literal[True] | BaseException | None = ...,
|
|
55
|
+
extra: dict[str, Incomplete] | None = ...,
|
|
56
|
+
frame: FrameType | None = ...,
|
|
57
|
+
dispatcher: Incomplete = ...,
|
|
58
|
+
frame_correction: int = ...,
|
|
59
|
+
) -> None: ...
|
|
60
|
+
@property
|
|
61
|
+
def message(self) -> str: ...
|
|
62
|
+
@property
|
|
63
|
+
def level_name(self) -> str: ...
|
|
64
|
+
@property
|
|
65
|
+
def calling_frame(self) -> FrameType | None: ...
|
|
66
|
+
@property
|
|
67
|
+
def func_name(self) -> str | None: ...
|
|
68
|
+
@property
|
|
69
|
+
def module(self) -> str | None: ...
|
|
70
|
+
@property
|
|
71
|
+
def filename(self) -> str | None: ...
|
|
72
|
+
@property
|
|
73
|
+
def lineno(self) -> int | None: ...
|
|
74
|
+
@property
|
|
75
|
+
def greenlet(self) -> int | None: ...
|
|
76
|
+
@property
|
|
77
|
+
def thread(self) -> int | None: ...
|
|
78
|
+
@property
|
|
79
|
+
def thread_name(self) -> str | None: ...
|
|
80
|
+
@property
|
|
81
|
+
def process_name(self) -> str | None: ...
|
|
82
|
+
@property
|
|
83
|
+
def formatted_exception(self) -> str | None: ...
|
|
84
|
+
@property
|
|
85
|
+
def exception_name(self) -> str | None: ...
|
|
86
|
+
@property
|
|
87
|
+
def exception_shortname(self) -> str | None: ...
|
|
88
|
+
@property
|
|
89
|
+
def exception_message(self) -> str | None: ...
|
|
90
|
+
@property
|
|
91
|
+
def dispatcher(self) -> Incomplete: ...
|
|
92
|
+
def heavy_init(self) -> None: ...
|
|
93
|
+
def pull_information(self) -> None: ...
|
|
94
|
+
def close(self) -> None: ...
|
|
95
|
+
def to_dict(self, json_safe: bool = ...) -> dict[str, Incomplete]: ...
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, d: dict[str, Incomplete]) -> LogRecord: ...
|
|
98
|
+
def update_from_dict(self, d: dict[str, Incomplete]) -> LogRecord: ...
|
|
99
|
+
|
|
100
|
+
class RecordDispatcher:
|
|
101
|
+
"""A record dispatcher is the internal base class that implements
|
|
102
|
+
the logic used by the :class:`~logbook.Logger`.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
suppress_dispatcher: bool
|
|
106
|
+
name: str | None
|
|
107
|
+
handlers: list['Handler']
|
|
108
|
+
group: LoggerGroup | None
|
|
109
|
+
level: int
|
|
110
|
+
disabled: bool
|
|
111
|
+
|
|
112
|
+
def __init__(self, name: str | None = None, level: int = ...) -> None: ...
|
|
113
|
+
def handle(self, record: LogRecord) -> None: ...
|
|
114
|
+
def make_record_and_handle(
|
|
115
|
+
self,
|
|
116
|
+
level: int,
|
|
117
|
+
msg: str,
|
|
118
|
+
args: tuple[Incomplete, ...],
|
|
119
|
+
kwargs: dict[str, Incomplete],
|
|
120
|
+
exc_info: _ExcInfo | Literal[True] | BaseException | None,
|
|
121
|
+
extra: dict[str, Incomplete] | None,
|
|
122
|
+
frame_correction: int,
|
|
123
|
+
) -> None: ...
|
|
124
|
+
def call_handlers(self, record: LogRecord) -> None: ...
|
|
125
|
+
|
|
126
|
+
class LoggerMixin:
|
|
127
|
+
"""This mixin class defines and implements the "usual" logger
|
|
128
|
+
interface (i.e. the descriptive logging functions).
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
level_name: str
|
|
132
|
+
|
|
133
|
+
def trace(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
134
|
+
def debug(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
135
|
+
def info(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
136
|
+
def notice(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
137
|
+
def warning(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
138
|
+
def error(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
139
|
+
def critical(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
140
|
+
def exception(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
141
|
+
def log(self, level: int, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
|
142
|
+
|
|
143
|
+
class Logger(RecordDispatcher, LoggerMixin):
|
|
144
|
+
"""Instances of the Logger class represent a single logging channel."""
|
|
145
|
+
|
|
146
|
+
def __init__(self, name: str | None = None, level: int = ...) -> None: ...
|
|
147
|
+
|
|
148
|
+
class LoggerGroup:
|
|
149
|
+
"""A LoggerGroup represents a group of loggers."""
|
|
150
|
+
|
|
151
|
+
loggers: list[Logger]
|
|
152
|
+
level: int
|
|
153
|
+
disabled: bool
|
|
154
|
+
processor: Incomplete | None
|
|
155
|
+
|
|
156
|
+
def __init__(
|
|
157
|
+
self,
|
|
158
|
+
loggers: list[Logger] | None = None,
|
|
159
|
+
level: int = ...,
|
|
160
|
+
processor: Incomplete | None = None,
|
|
161
|
+
) -> None: ...
|
|
162
|
+
def add_logger(self, logger: Logger) -> None: ...
|
|
163
|
+
def remove_logger(self, logger: Logger) -> None: ...
|
|
164
|
+
def process_record(self, record: LogRecord) -> None: ...
|
|
165
|
+
|
|
166
|
+
class Processor:
|
|
167
|
+
"""A context manager that processes log records with a given function."""
|
|
168
|
+
|
|
169
|
+
def __init__(self, callback: Callable[[LogRecord], None]) -> None: ...
|
|
170
|
+
def __enter__(self) -> Processor: ...
|
|
171
|
+
def __exit__(self, exc_type: object, exc_value: object, tb: object) -> None: ...
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from typing import IO, TYPE_CHECKING, Callable, Literal, Self
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
from threading import RLock
|
|
5
|
+
|
|
6
|
+
from _typeshed import Incomplete
|
|
7
|
+
from logbook.base import LogRecord
|
|
8
|
+
|
|
9
|
+
class Handler:
|
|
10
|
+
def emit(self, record: LogRecord) -> None: ...
|
|
11
|
+
def format(self, record: LogRecord) -> str: ...
|
|
12
|
+
def __enter__(self) -> Self: ...
|
|
13
|
+
def __exit__(self, exc_type: object, exc_value: object, tb: object) -> None: ...
|
|
14
|
+
|
|
15
|
+
class Formatter:
|
|
16
|
+
def __call__(self, record: LogRecord, handler: Handler) -> str: ...
|
|
17
|
+
|
|
18
|
+
class StringFormatterHandlerMixin: ...
|
|
19
|
+
|
|
20
|
+
class StreamHandler(Handler, StringFormatterHandlerMixin):
|
|
21
|
+
stream: IO[str]
|
|
22
|
+
lock: RLock
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
stream: Incomplete = ...,
|
|
26
|
+
level: int | str = 0,
|
|
27
|
+
format_string: str = '',
|
|
28
|
+
encoding: str | None = None,
|
|
29
|
+
filter: 'LogFilter | None' = None,
|
|
30
|
+
bubble: bool = False,
|
|
31
|
+
) -> None: ...
|
|
32
|
+
def ensure_stream_is_open(self) -> None: ...
|
|
33
|
+
def encode(self, msg: str) -> str: ...
|
|
34
|
+
def write(self, item: str) -> None: ...
|
|
35
|
+
def should_flush(self) -> Literal[True]: ...
|
|
36
|
+
def flush(self) -> None: ...
|
|
37
|
+
|
|
38
|
+
type LogFilter = Callable[[LogRecord, Handler], bool]
|
|
39
|
+
|
|
40
|
+
class StderrHandler(StreamHandler):
|
|
41
|
+
def __init__(
|
|
42
|
+
self, level: int | str = 0, format_string: str = '', filter: LogFilter | None = None, bubble: bool = False
|
|
43
|
+
) -> None: ...
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
'Handler',
|
|
47
|
+
'Formatter',
|
|
48
|
+
'StringFormatterHandlerMixin',
|
|
49
|
+
'StreamHandler',
|
|
50
|
+
'StderrHandler',
|
|
51
|
+
'LogFilter',
|
|
52
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "logbook-stubs"
|
|
3
|
+
description = "Type stubs for logbook"
|
|
4
|
+
version = "0.1.0"
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
|
|
7
|
+
[build-system]
|
|
8
|
+
requires = ["hatchling"]
|
|
9
|
+
build-backend = "hatchling.build"
|
|
10
|
+
|
|
11
|
+
[tool.hatch.build.targets.wheel]
|
|
12
|
+
packages = ["logbook"] # Package is at ./logbook/ relative to this pyproject.toml
|