summaryrefslogtreecommitdiffstats
path: root/manager/typings/supervisor/loggers.pyi
blob: b46f2336a4ecb356c7a8cd5a48390f68ac762dad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
"""
This type stub file was generated by pyright.
"""

"""
Logger implementation loosely modeled on PEP 282.  We don't use the
PEP 282 logger implementation in the stdlib ('logging') because it's
idiosyncratic and a bit slow for our purposes (we don't use threads).
"""
class LevelsByName:
    CRIT = ...
    ERRO = ...
    WARN = ...
    INFO = ...
    DEBG = ...
    TRAC = ...
    BLAT = ...


class LevelsByDescription:
    critical = ...
    error = ...
    warn = ...
    info = ...
    debug = ...
    trace = ...
    blather = ...


LOG_LEVELS_BY_NUM = ...
def getLevelNumByDescription(description): # -> Any | None:
    ...

class Handler:
    fmt = ...
    level = ...
    def __init__(self, stream=...) -> None:
        ...
    
    def setFormat(self, fmt): # -> None:
        ...
    
    def setLevel(self, level): # -> None:
        ...
    
    def flush(self): # -> None:
        ...
    
    def close(self): # -> None:
        ...
    
    def emit(self, record): # -> None:
        ...
    
    def handleError(self): # -> None:
        ...
    


class StreamHandler(Handler):
    def __init__(self, strm=...) -> None:
        ...
    
    def remove(self): # -> None:
        ...
    
    def reopen(self): # -> None:
        ...
    


class BoundIO:
    def __init__(self, maxbytes, buf=...) -> None:
        ...
    
    def flush(self): # -> None:
        ...
    
    def close(self): # -> None:
        ...
    
    def write(self, b): # -> None:
        ...
    
    def getvalue(self): # -> Unknown | bytes:
        ...
    
    def clear(self): # -> None:
        ...
    


class FileHandler(Handler):
    """File handler which supports reopening of logs.
    """
    def __init__(self, filename, mode=...) -> None:
        ...
    
    def reopen(self): # -> None:
        ...
    
    def remove(self): # -> None:
        ...
    


class RotatingFileHandler(FileHandler):
    def __init__(self, filename, mode=..., maxBytes=..., backupCount=...) -> None:
        """
        Open the specified file and use it as the stream for logging.

        By default, the file grows indefinitely. You can specify particular
        values of maxBytes and backupCount to allow the file to rollover at
        a predetermined size.

        Rollover occurs whenever the current log file is nearly maxBytes in
        length. If backupCount is >= 1, the system will successively create
        new files with the same pathname as the base file, but with extensions
        ".1", ".2" etc. appended to it. For example, with a backupCount of 5
        and a base file name of "app.log", you would get "app.log",
        "app.log.1", "app.log.2", ... through to "app.log.5". The file being
        written to is always "app.log" - when it gets filled up, it is closed
        and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc.
        exist, then they are renamed to "app.log.2", "app.log.3" etc.
        respectively.

        If maxBytes is zero, rollover never occurs.
        """
        ...
    
    def emit(self, record): # -> None:
        """
        Emit a record.

        Output the record to the file, catering for rollover as described
        in doRollover().
        """
        ...
    
    def removeAndRename(self, sfn, dfn): # -> None:
        ...
    
    def doRollover(self): # -> None:
        """
        Do a rollover, as described in __init__().
        """
        ...
    


class LogRecord:
    def __init__(self, level, msg, **kw) -> None:
        ...
    
    def asdict(self): # -> dict[str, str | Unknown]:
        ...
    


class Logger:
    def __init__(self, level=..., handlers=...) -> None:
        ...
    
    def close(self): # -> None:
        ...
    
    def blather(self, msg, **kw): # -> None:
        ...
    
    def trace(self, msg, **kw): # -> None:
        ...
    
    def debug(self, msg, **kw): # -> None:
        ...
    
    def info(self, msg, **kw): # -> None:
        ...
    
    def warn(self, msg, **kw): # -> None:
        ...
    
    def error(self, msg, **kw): # -> None:
        ...
    
    def critical(self, msg, **kw): # -> None:
        ...
    
    def log(self, level, msg, **kw): # -> None:
        ...
    
    def addHandler(self, hdlr): # -> None:
        ...
    
    def getvalue(self):
        ...
    


class SyslogHandler(Handler):
    def __init__(self) -> None:
        ...
    
    def close(self): # -> None:
        ...
    
    def reopen(self): # -> None:
        ...
    
    def emit(self, record): # -> None:
        ...
    


def getLogger(level=...): # -> Logger:
    ...

_2MB = ...
def handle_boundIO(logger, fmt, maxbytes=...): # -> None:
    """Attach a new BoundIO handler to an existing Logger"""
    ...

def handle_stdout(logger, fmt): # -> None:
    """Attach a new StreamHandler with stdout handler to an existing Logger"""
    ...

def handle_syslog(logger, fmt): # -> None:
    """Attach a new Syslog handler to an existing Logger"""
    ...

def handle_file(logger, filename, fmt, rotating=..., maxbytes=..., backups=...): # -> None:
    """Attach a new file handler to an existing Logger. If the filename
    is the magic name of 'syslog' then make it a syslog handler instead."""
    ...