mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
add types to logging (#247)
This commit is contained in:
committed by
Guido van Rossum
parent
e8e82a7c73
commit
a581397c42
@@ -1,239 +0,0 @@
|
||||
# Stubs for logging (Python 2.7)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Dict, Optional, Sequence, Tuple, overload, Union
|
||||
|
||||
CRITICAL = ... # type: int
|
||||
FATAL = ... # type: int
|
||||
ERROR = ... # type: int
|
||||
WARNING = ... # type: int
|
||||
WARN = ... # type: int
|
||||
INFO = ... # type: int
|
||||
DEBUG = ... # type: int
|
||||
NOTSET = ... # type: int
|
||||
|
||||
def getLevelName(level: int) -> str: ...
|
||||
def addLevelName(level: int, levelName: str) -> None: ...
|
||||
|
||||
class LogRecord:
|
||||
name = ... # type: str
|
||||
msg = ... # type: str
|
||||
args = ... # type: Sequence[Any]
|
||||
levelname = ... # type: str
|
||||
levelno = ... # type: int
|
||||
pathname = ... # type: str
|
||||
filename = ... # type: str
|
||||
module = ... # type: str
|
||||
exc_info = ... # type: Tuple[Any, Any, Any]
|
||||
exc_text = ... # type: str
|
||||
lineno = ... # type: int
|
||||
funcName = ... # type: Optional[str]
|
||||
created = ... # type: float
|
||||
msecs = ... # type: float
|
||||
relativeCreated = ... # type: float
|
||||
thread = ... # type: Any
|
||||
threadName = ... # type: Any
|
||||
processName = ... # type: Any
|
||||
process = ... # type: Any
|
||||
def __init__(self, name: str, level: int, pathname: str, lineno: int, msg: str,
|
||||
args: Sequence[Any], exc_info: Tuple[Any, Any, Any], func: str = ...) -> None: ...
|
||||
def getMessage(self) -> str: ...
|
||||
|
||||
def makeLogRecord(dict: Dict[str, Any]) -> LogRecord: ...
|
||||
|
||||
class PercentStyle:
|
||||
default_format = ... # type: Any
|
||||
asctime_format = ... # type: Any
|
||||
asctime_search = ... # type: Any
|
||||
def __init__(self, fmt) -> None: ...
|
||||
def usesTime(self) -> bool: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
|
||||
class StrFormatStyle(PercentStyle):
|
||||
default_format = ... # type: Any
|
||||
asctime_format = ... # type: Any
|
||||
asctime_search = ... # type: Any
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
|
||||
class StringTemplateStyle(PercentStyle):
|
||||
default_format = ... # type: Any
|
||||
asctime_format = ... # type: Any
|
||||
asctime_search = ... # type: Any
|
||||
def __init__(self, fmt) -> None: ...
|
||||
def usesTime(self) -> bool: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
|
||||
BASIC_FORMAT = ... # type: Any
|
||||
|
||||
class Formatter:
|
||||
converter = ... # type: Any
|
||||
datefmt = ... # type: Any
|
||||
def __init__(self, fmt: str = ..., datefmt: str = ...) -> None: ...
|
||||
default_time_format = ... # type: Any
|
||||
default_msec_format = ... # type: Any
|
||||
def formatTime(self, record: LogRecord, datefmt: str =...) -> str: ...
|
||||
def formatException(self, ei) -> str: ...
|
||||
def usesTime(self) -> bool: ...
|
||||
def formatMessage(self, record: LogRecord) -> str: ...
|
||||
def formatStack(self, stack_info) -> str: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
|
||||
class BufferingFormatter:
|
||||
linefmt = ... # type: Any
|
||||
def __init__(self, linefmt: Formatter =...) -> None: ...
|
||||
def formatHeader(self, records: list[LogRecord]) -> str: ...
|
||||
def formatFooter(self, records: list[LogRecord]) -> str: ...
|
||||
def format(self, records: list[LogRecord]) -> str: ...
|
||||
|
||||
class Filter:
|
||||
name = ... # type: Any
|
||||
nlen = ... # type: Any
|
||||
def __init__(self, name: str = ...) -> None: ...
|
||||
def filter(self, record: LogRecord) -> int: ...
|
||||
|
||||
class Filterer:
|
||||
filters = ... # type: Any
|
||||
def __init__(self) -> None: ...
|
||||
def addFilter(self, filter: Filter) -> None: ...
|
||||
def removeFilter(self, filter: Filter) -> None: ...
|
||||
def filter(self, record: LogRecord) -> int: ...
|
||||
|
||||
class Handler(Filterer):
|
||||
level = ... # type: Any
|
||||
formatter = ... # type: Any
|
||||
def __init__(self, level: int = ...) -> None: ...
|
||||
def get_name(self): ...
|
||||
def set_name(self, name) -> None: ...
|
||||
name = ... # type: Any
|
||||
lock = ... # type: Any
|
||||
def createLock(self) -> None: ...
|
||||
def acquire(self) -> None: ...
|
||||
def release(self) -> None: ...
|
||||
def setLevel(self, level: int) -> None: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def handle(self, record: LogRecord) -> Any: ... # Return value undocumented
|
||||
def setFormatter(self, fmt: Formatter) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def handleError(self, record: LogRecord) -> None: ...
|
||||
|
||||
class StreamHandler(Handler):
|
||||
terminator = ... # type: Any
|
||||
stream = ... # type: Any
|
||||
def __init__(self, stream=...) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class FileHandler(StreamHandler):
|
||||
baseFilename = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
encoding = ... # type: Any
|
||||
delay = ... # type: Any
|
||||
stream = ... # type: Any
|
||||
def __init__(self, filename: str, mode: str = ..., encoding: str = ..., delay: int = ...) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class _StderrHandler(StreamHandler):
|
||||
def __init__(self, level: int =...) -> None: ...
|
||||
|
||||
lastResort = ... # type: Any
|
||||
|
||||
class PlaceHolder:
|
||||
loggerMap = ... # type: Any
|
||||
def __init__(self, alogger) -> None: ...
|
||||
def append(self, alogger) -> None: ...
|
||||
|
||||
def setLoggerClass(klass) -> None: ...
|
||||
def getLoggerClass(): ...
|
||||
|
||||
class Manager:
|
||||
root = ... # type: Any
|
||||
disable = ... # type: Any
|
||||
emittedNoHandlerWarning = ... # type: Any
|
||||
loggerDict = ... # type: Any
|
||||
loggerClass = ... # type: Any
|
||||
logRecordFactory = ... # type: Any
|
||||
def __init__(self, rootnode) -> None: ...
|
||||
def getLogger(self, name: unicode): ...
|
||||
def setLoggerClass(self, klass) -> None: ...
|
||||
def setLogRecordFactory(self, factory) -> None: ...
|
||||
|
||||
class Logger(Filterer):
|
||||
name = ... # type: Any
|
||||
level = ... # type: Any
|
||||
parent = ... # type: Any
|
||||
propagate = False
|
||||
handlers = ... # type: Any
|
||||
disabled = ... # type: Any
|
||||
def __init__(self, name: str, level: int = ...) -> None: ...
|
||||
def setLevel(self, level: int) -> None: ...
|
||||
def debug(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def info(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def warning(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def warn(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def error(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def exception(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def critical(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
fatal = ... # type: Any
|
||||
def log(self, level: int, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def findCaller(self) -> Tuple[str, int, str]: ...
|
||||
def makeRecord(self, name, level: int, fn, lno, msg, args,
|
||||
exc_info, func=..., extra=..., sinfo=...) -> LogRecord: ...
|
||||
def handle(self, record: LogRecord) -> None: ...
|
||||
def addHandler(self, hdlr: Handler) -> None: ...
|
||||
def removeHandler(self, hdlr: Handler) -> None: ...
|
||||
def hasHandlers(self) -> None: ...
|
||||
def callHandlers(self, record: LogRecord) -> None: ...
|
||||
def getEffectiveLevel(self) -> int: ...
|
||||
def isEnabledFor(self, level: int) -> bool: ...
|
||||
def getChild(self, suffix: str) -> Logger: ...
|
||||
|
||||
class RootLogger(Logger):
|
||||
def __init__(self, level: int) -> None: ...
|
||||
|
||||
class LoggerAdapter:
|
||||
logger = ... # type: Any
|
||||
extra = ... # type: Any
|
||||
def __init__(self, logger, extra) -> None: ...
|
||||
def process(self, msg, kwargs) -> Tuple[Any,Any]: ... # Possible mistake: kwargs missing **
|
||||
def debug(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def info(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def warning(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def warn(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def error(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def exception(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def critical(self, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def log(self, level: int, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def isEnabledFor(self, level: int) -> bool: ...
|
||||
def setLevel(self, level: int) -> None: ...
|
||||
def getEffectiveLevel(self) -> int: ...
|
||||
def hasHandlers(self) -> bool: ...
|
||||
|
||||
def basicConfig(**kwargs) -> None: ...
|
||||
def getLogger(name: str = ...) -> Logger: ...
|
||||
def critical(msg: str, *args, **kwargs) -> None: ...
|
||||
|
||||
fatal = ... # type: Any
|
||||
|
||||
def error(msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
@overload
|
||||
def exception(msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
@overload
|
||||
def exception(exception: Exception, *args, **kwargs) -> None: ...
|
||||
def warning(msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def warn(msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def info(msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def debug(msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def log(level: int, msg: Union[str, unicode], *args, **kwargs) -> None: ...
|
||||
def disable(level: int) -> None: ...
|
||||
|
||||
class NullHandler(Handler):
|
||||
def handle(self, record: LogRecord) -> None: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
lock = ... # type: Any
|
||||
def createLock(self): ...
|
||||
|
||||
def captureWarnings(capture: bool) -> None: ...
|
||||
@@ -1,202 +0,0 @@
|
||||
# Stubs for logging.handlers (Python 2.7)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Union, Tuple
|
||||
from . import LogRecord
|
||||
import logging
|
||||
import socket
|
||||
|
||||
threading = ... # type: Any
|
||||
DEFAULT_TCP_LOGGING_PORT = ... # type: Any
|
||||
DEFAULT_UDP_LOGGING_PORT = ... # type: Any
|
||||
DEFAULT_HTTP_LOGGING_PORT = ... # type: Any
|
||||
DEFAULT_SOAP_LOGGING_PORT = ... # type: Any
|
||||
SYSLOG_UDP_PORT = ... # type: Any
|
||||
SYSLOG_TCP_PORT = ... # type: Any
|
||||
|
||||
class BaseRotatingHandler(logging.FileHandler):
|
||||
mode = ... # type: Any
|
||||
encoding = ... # type: Any
|
||||
namer = ... # type: Any
|
||||
rotator = ... # type: Any
|
||||
def __init__(self, filename: unicode, mode: unicode, encoding: unicode =..., delay: int =...) -> None: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def rotation_filename(self, default_name: unicode): ...
|
||||
def rotate(self, source, dest): ...
|
||||
|
||||
class RotatingFileHandler(BaseRotatingHandler):
|
||||
maxBytes = ... # type: Any
|
||||
backupCount = ... # type: Any
|
||||
def __init__(self, filename: unicode, mode: unicode = ..., maxBytes: int = ..., backupCount:int = ...,
|
||||
encoding: str = ..., delay: int = ...) -> None: ...
|
||||
stream = ... # type: Any
|
||||
def doRollover(self) -> None: ...
|
||||
def shouldRollover(self, record: LogRecord) -> int: ...
|
||||
|
||||
class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
when = ... # type: Any
|
||||
backupCount = ... # type: Any
|
||||
utc = ... # type: Any
|
||||
atTime = ... # type: Any
|
||||
interval = ... # type: Any
|
||||
suffix = ... # type: Any
|
||||
extMatch = ... # type: Any
|
||||
dayOfWeek = ... # type: Any
|
||||
rolloverAt = ... # type: Any
|
||||
def __init__(self, filename: unicode, when: unicode =..., interval: int =..., backupCount: int =...,
|
||||
encoding: unicode =..., delay: bool =..., utc: bool =..., atTime=...) -> None: ...
|
||||
def computeRollover(self, currentTime: int) -> int: ...
|
||||
def shouldRollover(self, record: LogRecord) -> int: ...
|
||||
def getFilesToDelete(self) -> list[str]: ...
|
||||
stream = ... # type: Any
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
class WatchedFileHandler(logging.FileHandler):
|
||||
def __init__(self, filename: str, mode: str = ..., encoding: str = ..., delay: int = ...) -> None: ...
|
||||
stream = ... # type: Any
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class SocketHandler(logging.Handler):
|
||||
host = ... # type: Any
|
||||
port = ... # type: Any
|
||||
address = ... # type: Any
|
||||
sock = ... # type: Any
|
||||
closeOnError = ... # type: Any
|
||||
retryTime = ... # type: Any
|
||||
retryStart = ... # type: Any
|
||||
retryMax = ... # type: Any
|
||||
retryFactor = ... # type: Any
|
||||
def __init__(self, host, port) -> None: ...
|
||||
def makeSocket(self, timeout: int =...): ...
|
||||
retryPeriod = ... # type: Any
|
||||
def createSocket(self) -> None: ...
|
||||
def send(self, s: str) -> None: ...
|
||||
def makePickle(self, record: LogRecord) -> str: ...
|
||||
def handleError(self, record: LogRecord) -> None: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class DatagramHandler(SocketHandler):
|
||||
closeOnError = ... # type: Any
|
||||
def __init__(self, host, port) -> None: ...
|
||||
def makeSocket(self, timeout: int =...) -> None: ...
|
||||
def send(self, s: str) -> None: ...
|
||||
|
||||
class SysLogHandler(logging.Handler):
|
||||
LOG_EMERG = ... # type: Any
|
||||
LOG_ALERT = ... # type: Any
|
||||
LOG_CRIT = ... # type: Any
|
||||
LOG_ERR = ... # type: Any
|
||||
LOG_WARNING = ... # type: Any
|
||||
LOG_NOTICE = ... # type: Any
|
||||
LOG_INFO = ... # type: Any
|
||||
LOG_DEBUG = ... # type: Any
|
||||
LOG_KERN = ... # type: Any
|
||||
LOG_USER = ... # type: Any
|
||||
LOG_MAIL = ... # type: Any
|
||||
LOG_DAEMON = ... # type: Any
|
||||
LOG_AUTH = ... # type: Any
|
||||
LOG_SYSLOG = ... # type: Any
|
||||
LOG_LPR = ... # type: Any
|
||||
LOG_NEWS = ... # type: Any
|
||||
LOG_UUCP = ... # type: Any
|
||||
LOG_CRON = ... # type: Any
|
||||
LOG_AUTHPRIV = ... # type: Any
|
||||
LOG_FTP = ... # type: Any
|
||||
LOG_LOCAL0 = ... # type: Any
|
||||
LOG_LOCAL1 = ... # type: Any
|
||||
LOG_LOCAL2 = ... # type: Any
|
||||
LOG_LOCAL3 = ... # type: Any
|
||||
LOG_LOCAL4 = ... # type: Any
|
||||
LOG_LOCAL5 = ... # type: Any
|
||||
LOG_LOCAL6 = ... # type: Any
|
||||
LOG_LOCAL7 = ... # type: Any
|
||||
priority_names = ... # type: Any
|
||||
facility_names = ... # type: Any
|
||||
priority_map = ... # type: Any
|
||||
address = ... # type: Any
|
||||
facility = ... # type: Any
|
||||
socktype = ... # type: Any
|
||||
unixsocket = ... # type: Any
|
||||
socket = ... # type: Any
|
||||
formatter = ... # type: Any
|
||||
def __init__(self, address: tuple[str,int] =..., facility: int =..., socktype: int =...) -> None: ...
|
||||
def encodePriority(self, facility: int, priority: Union[basestring,int]) -> int: ...
|
||||
def close(self) -> None: ...
|
||||
def mapPriority(self, levelName: str) -> str: ...
|
||||
ident = ... # type: Any
|
||||
append_nul = ... # type: Any
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class SMTPHandler(logging.Handler):
|
||||
username = ... # type: Any
|
||||
fromaddr = ... # type: Any
|
||||
toaddrs = ... # type: Any
|
||||
subject = ... # type: Any
|
||||
secure = ... # type: Any
|
||||
timeout = ... # type: Any
|
||||
def __init__(self, mailhost, fromaddr, toaddrs, subject: unicode, credentials: Tuple[Any,Any]=...,
|
||||
secure=...) -> None: ...
|
||||
def getSubject(self, record: LogRecord) -> unicode: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class NTEventLogHandler(logging.Handler):
|
||||
appname = ... # type: Any
|
||||
dllname = ... # type: Any
|
||||
logtype = ... # type: Any
|
||||
deftype = ... # type: Any
|
||||
typemap = ... # type: Any
|
||||
def __init__(self, appname, dllname=..., logtype: str =...) -> None: ...
|
||||
def getMessageID(self, record: LogRecord) -> int: ...
|
||||
def getEventCategory(self, record: LogRecord) -> int: ...
|
||||
def getEventType(self, record: LogRecord): ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class HTTPHandler(logging.Handler):
|
||||
host = ... # type: Any
|
||||
url = ... # type: Any
|
||||
method = ... # type: Any
|
||||
secure = ... # type: Any
|
||||
credentials = ... # type: Any
|
||||
def __init__(self, host, url, method: str =..., secure=..., credentials=...) -> None: ...
|
||||
def mapLogRecord(self, record: LogRecord) -> dict[Any,Any]: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class BufferingHandler(logging.Handler):
|
||||
capacity = ... # type: Any
|
||||
buffer = ... # type: Any
|
||||
def __init__(self, capacity: int) -> None: ...
|
||||
def shouldFlush(self, record: LogRecord) -> bool: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class MemoryHandler(BufferingHandler):
|
||||
flushLevel = ... # type: Any
|
||||
target = ... # type: Any
|
||||
def __init__(self, capacity: int, flushLevel: int =..., target=...) -> None: ...
|
||||
def shouldFlush(self, record: LogRecord) -> bool: ...
|
||||
def setTarget(self, target) -> None: ...
|
||||
buffer = ... # type: Any
|
||||
def flush(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class QueueHandler(logging.Handler):
|
||||
queue = ... # type: Any
|
||||
def __init__(self, queue) -> None: ...
|
||||
def enqueue(self, record: LogRecord): ...
|
||||
def prepare(self, record: LogRecord): ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
class QueueListener:
|
||||
queue = ... # type: Any
|
||||
handlers = ... # type: Any
|
||||
def __init__(self, queue, *handlers) -> None: ...
|
||||
def dequeue(self, block): ...
|
||||
def start(self) -> None: ...
|
||||
def prepare(self, record: LogRecord): ...
|
||||
def handle(self, record: LogRecord): ...
|
||||
def enqueue_sentinel(self): ...
|
||||
def stop(self) -> None: ...
|
||||
Reference in New Issue
Block a user