diff --git a/changelog/index.html b/changelog/index.html index a0b27f0..762d33f 100644 --- a/changelog/index.html +++ b/changelog/index.html @@ -345,6 +345,21 @@ + +
  • @@ -424,7 +439,7 @@
  • - + Changed @@ -499,7 +514,7 @@
  • - + Changed @@ -556,7 +571,7 @@
  • - + Changed @@ -589,7 +604,7 @@
  • - + Changed @@ -739,6 +754,21 @@ + +
  • @@ -818,7 +848,7 @@
  • - + Changed @@ -893,7 +923,7 @@
  • - + Changed @@ -950,7 +980,7 @@
  • - + Changed @@ -983,7 +1013,7 @@
  • - + Changed @@ -1115,6 +1145,10 @@

    Changelog

    The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

    [Unreleased]

    +

    Changed

    +

    [5.0.0] - 2025-01-25

    Added

    -

    Changed

    +

    Changed

    diff --git a/search/search_index.json b/search/search_index.json index dc731d9..b4a2e35 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"tinylogging","text":""},{"location":"#installation","title":"Installation","text":"
    pip install tinylogging\n
    "},{"location":"#usage","title":"Usage","text":""},{"location":"#new-logger","title":"New logger","text":"
    from tinylogging import Logger, Level\n\nlogger = Logger(name=\"my_logger\", level=Level.DEBUG)\n
    "},{"location":"#logging-messages","title":"Logging messages","text":"
    logger.info(\"This is an info message.\")\nlogger.error(\"This is an error message.\")\nlogger.debug(\"This is a debug message.\")\n
    "},{"location":"#logging-to-a-file","title":"Logging to a file","text":"
    from tinylogging import FileHandler\n\nfile_handler = FileHandler(file_name=\"app.log\", level=Level.WARNING)\nlogger.handlers.add(file_handler)\n\nlogger.warning(\"This warning will be logged to both console and file.\")\n
    "},{"location":"#custom-formatting","title":"Custom formatting","text":"
    from tinylogging import Formatter\n\nformatter = Formatter(template=\"{time} - {name} - {level} - {message}\", colorize=False)\nlogger = Logger(name=\"custom_logger\", formatter=formatter)\nlogger.info(\"This log message uses a custom format.\")\n
    "},{"location":"#disabling-logging","title":"Disabling logging","text":"
    logger.disable()\nlogger.info(\"This message will not be logged.\")\nlogger.enable()\n
    "},{"location":"#async-support","title":"Async support","text":"
    import asyncio\nfrom tinylogging import AsyncLogger, AsyncFileHandler\n\n\nasync def main():\n    logger = AsyncLogger(name=\"async_logger\")\n\n    file_handler = AsyncFileHandler(file_name=\"app.log\")\n    logger.handlers.add(file_handler)\n\n    await logger.info(\"This is an info message.\")\n    await logger.error(\"This is an error message.\")\n    await logger.debug(\"This is a debug message.\")\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main)\n
    "},{"location":"#license","title":"License","text":"

    This project is licensed under the MIT License.

    "},{"location":"api/","title":"API reference","text":""},{"location":"api/#tinylogging","title":"tinylogging","text":""},{"location":"api/#tinylogging.AsyncLogger","title":"AsyncLogger","text":""},{"location":"api/#tinylogging.AsyncLogger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseAsyncHandler] = set()) -> None\n

    Initializes an asynchronous logger.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseAsyncHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.AsyncLogger.log","title":"log async","text":"
    log(message: str, level: Level) -> None\n

    Logs a message at the specified level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The level at which to log the message.

    required"},{"location":"api/#tinylogging.AsyncLogger.trace","title":"trace async","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.debug","title":"debug async","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.info","title":"info async","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.notice","title":"notice async","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.warning","title":"warning async","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.error","title":"error async","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.critical","title":"critical async","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.AsyncLogger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.AsyncFileHandler","title":"AsyncFileHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for writing log records to a file.

    "},{"location":"api/#tinylogging.AsyncFileHandler.__init__","title":"__init__","text":"
    __init__(file_name: str, level: Level = NOTSET, formatter: Formatter = Formatter(colorize=False)) -> None\n

    Initializes the AsyncFileHandler.

    Parameters:

    Name Type Description Default file_name str

    The name of the file to write log records to.

    required level Level

    The logging level threshold for this handler.

    NOTSET formatter Formatter

    The formatter instance to format log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.AsyncFileHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.AsyncStreamHandler","title":"AsyncStreamHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for streaming log records.

    "},{"location":"api/#tinylogging.AsyncStreamHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET, stream: Optional[AsyncFile[str]] = None) -> None\n

    Initializes the AsyncStreamHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET stream Optional[AsyncFile[str]]

    The stream to write log records to.

    None"},{"location":"api/#tinylogging.AsyncStreamHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.AsyncTelegramHandler","title":"AsyncTelegramHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for sending log records to a Telegram chat.

    "},{"location":"api/#tinylogging.AsyncTelegramHandler.__init__","title":"__init__","text":"
    __init__(token: str, chat_id: int | str, message_thread_id: Optional[int] = None, ignore_errors: bool = False, **kwargs: Any) -> None\n

    Initializes the AsyncTelegramHandler.

    Parameters:

    Name Type Description Default token str

    The Telegram bot token.

    required chat_id int | str

    The chat ID to send log records to.

    required message_thread_id Optional[int]

    The message thread ID (optional).

    None ignore_errors bool

    Whether to ignore errors during sending.

    False **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.AsyncTelegramHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.BaseAsyncHandler","title":"BaseAsyncHandler","text":"

    Bases: ABC

    Base class for all async handlers.

    "},{"location":"api/#tinylogging.BaseAsyncHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET) -> None\n

    Initializes the BaseAsyncHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET"},{"location":"api/#tinylogging.BaseAsyncHandler.emit","title":"emit abstractmethod async","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required

    Raises:

    Type Description NotImplementedError

    This method should be overridden by subclasses.

    "},{"location":"api/#tinylogging.BaseAsyncHandler.handle","title":"handle async","text":"
    handle(record: Record) -> None\n

    Handle a log record if it meets the logging level threshold.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.Formatter","title":"Formatter","text":""},{"location":"api/#tinylogging.Formatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '[%H:%M:%S]', template: str = '{time} | {level} | {relpath}:{line} | {message}', colorize: bool = True) -> None\n

    Initializes the Formatter instance.

    Parameters:

    Name Type Description Default time_format str

    The format for the timestamp in log messages.

    '[%H:%M:%S]' template str

    The template for formatting log messages.

    '{time} | {level} | {relpath}:{line} | {message}' colorize bool

    Whether to colorize the log messages.

    True"},{"location":"api/#tinylogging.Formatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log message.

    "},{"location":"api/#tinylogging.Level","title":"Level","text":"

    Bases: IntEnum

    Enumeration for logging levels.

    Attributes:

    Name Type Description NOTSET

    No level set.

    TRACE

    Trace level for detailed debugging.

    DEBUG

    Debug level for general debugging.

    INFO

    Informational messages.

    NOTICE

    Notice level for normal but significant conditions.

    WARNING

    Warning level for potentially harmful situations.

    ERROR

    Error level for error events.

    CRITICAL

    Critical level for severe error events.

    "},{"location":"api/#tinylogging.Record","title":"Record dataclass","text":"

    Represents a log record.

    Attributes:

    Name Type Description message str

    The log message.

    level Level

    The log level.

    name str

    The name of the logger.

    time datetime

    The time the log record was created.

    filename str

    The name of the file where the log record was created.

    line int

    The line number in the file where the log record was created.

    function str

    The function name where the log record was created.

    "},{"location":"api/#tinylogging.Record.basename","title":"basename property","text":"
    basename: str\n

    Gets the base name of the file where the log record was created.

    Returns:

    Name Type Description str str

    The base name of the file.

    "},{"location":"api/#tinylogging.Record.relpath","title":"relpath property","text":"
    relpath: str\n

    Gets the relative path of the file where the log record was created.

    Returns:

    Name Type Description str str

    The relative path of the file.

    "},{"location":"api/#tinylogging.Record.__post_init__","title":"__post_init__","text":"
    __post_init__() -> None\n

    Initializes additional attributes after the dataclass is created.

    Raises:

    Type Description RuntimeError

    If the stack frame cannot be retrieved.

    "},{"location":"api/#tinylogging.Record.to_dict","title":"to_dict","text":"
    to_dict() -> dict[str, Any]\n

    Converts the log record to a dictionary.

    Returns:

    Name Type Description dict dict[str, Any]

    A dictionary representation of the log record.

    "},{"location":"api/#tinylogging.Logger","title":"Logger","text":""},{"location":"api/#tinylogging.Logger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseHandler] = set()) -> None\n

    Initializes a new Logger instance.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.Logger.log","title":"log","text":"
    log(message: str, level: Level) -> None\n

    Logs a message with the specified logging level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The logging level for the message.

    required"},{"location":"api/#tinylogging.Logger.trace","title":"trace","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.debug","title":"debug","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.info","title":"info","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.notice","title":"notice","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.warning","title":"warning","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.error","title":"error","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.critical","title":"critical","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.Logger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.BaseHandler","title":"BaseHandler","text":"

    Bases: ABC

    Abstract base class for all handlers.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET"},{"location":"api/#tinylogging.BaseHandler.emit","title":"emit abstractmethod","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.BaseHandler.handle","title":"handle","text":"
    handle(record: Record) -> None\n

    Handle a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.FileHandler","title":"FileHandler","text":"

    Bases: BaseHandler

    Handler for writing log records to a file.

    Parameters:

    Name Type Description Default file_name str

    Name of the file to write log records to.

    required level Level

    Logging level for the handler.

    NOTSET formatter Formatter

    Formatter instance to format the log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.FileHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.LoggingAdapterHandler","title":"LoggingAdapterHandler","text":"

    Bases: Handler

    Adapter handler to integrate with the standard logging module.

    Parameters:

    Name Type Description Default handler BaseHandler

    Custom handler to delegate log records to.

    required"},{"location":"api/#tinylogging.LoggingAdapterHandler.emit","title":"emit","text":"
    emit(record: LogRecord) -> None\n

    Emit a log record using the custom handler.

    Parameters:

    Name Type Description Default record LogRecord

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.StreamHandler","title":"StreamHandler","text":"

    Bases: BaseHandler

    Handler for streaming log records to a stream.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET stream Optional[TextIO]

    Stream to write log records to.

    None"},{"location":"api/#tinylogging.StreamHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.TelegramHandler","title":"TelegramHandler","text":"

    Bases: BaseHandler

    Handler for sending log records to a Telegram chat.

    Parameters:

    Name Type Description Default token str

    Telegram bot token.

    required chat_id int | str

    Chat ID to send messages to.

    required ignore_errors bool

    Whether to ignore errors when sending messages.

    False message_thread_id Optional[int]

    ID of the message thread.

    None **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.TelegramHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio","title":"aio","text":""},{"location":"api/#tinylogging.aio.AsyncFileHandler","title":"AsyncFileHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for writing log records to a file.

    "},{"location":"api/#tinylogging.aio.AsyncFileHandler.__init__","title":"__init__","text":"
    __init__(file_name: str, level: Level = NOTSET, formatter: Formatter = Formatter(colorize=False)) -> None\n

    Initializes the AsyncFileHandler.

    Parameters:

    Name Type Description Default file_name str

    The name of the file to write log records to.

    required level Level

    The logging level threshold for this handler.

    NOTSET formatter Formatter

    The formatter instance to format log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.aio.AsyncFileHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.AsyncTelegramHandler","title":"AsyncTelegramHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for sending log records to a Telegram chat.

    "},{"location":"api/#tinylogging.aio.AsyncTelegramHandler.__init__","title":"__init__","text":"
    __init__(token: str, chat_id: int | str, message_thread_id: Optional[int] = None, ignore_errors: bool = False, **kwargs: Any) -> None\n

    Initializes the AsyncTelegramHandler.

    Parameters:

    Name Type Description Default token str

    The Telegram bot token.

    required chat_id int | str

    The chat ID to send log records to.

    required message_thread_id Optional[int]

    The message thread ID (optional).

    None ignore_errors bool

    Whether to ignore errors during sending.

    False **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.aio.AsyncTelegramHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.BaseAsyncHandler","title":"BaseAsyncHandler","text":"

    Bases: ABC

    Base class for all async handlers.

    "},{"location":"api/#tinylogging.aio.BaseAsyncHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET) -> None\n

    Initializes the BaseAsyncHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET"},{"location":"api/#tinylogging.aio.BaseAsyncHandler.emit","title":"emit abstractmethod async","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required

    Raises:

    Type Description NotImplementedError

    This method should be overridden by subclasses.

    "},{"location":"api/#tinylogging.aio.BaseAsyncHandler.handle","title":"handle async","text":"
    handle(record: Record) -> None\n

    Handle a log record if it meets the logging level threshold.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger","title":"AsyncLogger","text":""},{"location":"api/#tinylogging.aio.AsyncLogger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseAsyncHandler] = set()) -> None\n

    Initializes an asynchronous logger.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseAsyncHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.aio.AsyncLogger.log","title":"log async","text":"
    log(message: str, level: Level) -> None\n

    Logs a message at the specified level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The level at which to log the message.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.trace","title":"trace async","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.debug","title":"debug async","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.info","title":"info async","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.notice","title":"notice async","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.warning","title":"warning async","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.error","title":"error async","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.critical","title":"critical async","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.aio.AsyncLogger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.aio.handlers","title":"handlers","text":""},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler","title":"BaseAsyncHandler","text":"

    Bases: ABC

    Base class for all async handlers.

    "},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET) -> None\n

    Initializes the BaseAsyncHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET"},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler.emit","title":"emit abstractmethod async","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required

    Raises:

    Type Description NotImplementedError

    This method should be overridden by subclasses.

    "},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler.handle","title":"handle async","text":"
    handle(record: Record) -> None\n

    Handle a log record if it meets the logging level threshold.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.aio.handlers.AsyncStreamHandler","title":"AsyncStreamHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for streaming log records.

    "},{"location":"api/#tinylogging.aio.handlers.AsyncStreamHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET, stream: Optional[AsyncFile[str]] = None) -> None\n

    Initializes the AsyncStreamHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET stream Optional[AsyncFile[str]]

    The stream to write log records to.

    None"},{"location":"api/#tinylogging.aio.handlers.AsyncStreamHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.handlers.AsyncFileHandler","title":"AsyncFileHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for writing log records to a file.

    "},{"location":"api/#tinylogging.aio.handlers.AsyncFileHandler.__init__","title":"__init__","text":"
    __init__(file_name: str, level: Level = NOTSET, formatter: Formatter = Formatter(colorize=False)) -> None\n

    Initializes the AsyncFileHandler.

    Parameters:

    Name Type Description Default file_name str

    The name of the file to write log records to.

    required level Level

    The logging level threshold for this handler.

    NOTSET formatter Formatter

    The formatter instance to format log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.aio.handlers.AsyncFileHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.handlers.AsyncTelegramHandler","title":"AsyncTelegramHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for sending log records to a Telegram chat.

    "},{"location":"api/#tinylogging.aio.handlers.AsyncTelegramHandler.__init__","title":"__init__","text":"
    __init__(token: str, chat_id: int | str, message_thread_id: Optional[int] = None, ignore_errors: bool = False, **kwargs: Any) -> None\n

    Initializes the AsyncTelegramHandler.

    Parameters:

    Name Type Description Default token str

    The Telegram bot token.

    required chat_id int | str

    The chat ID to send log records to.

    required message_thread_id Optional[int]

    The message thread ID (optional).

    None ignore_errors bool

    Whether to ignore errors during sending.

    False **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.aio.handlers.AsyncTelegramHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.formatter","title":"formatter","text":""},{"location":"api/#tinylogging.formatter.Formatter","title":"Formatter","text":""},{"location":"api/#tinylogging.formatter.Formatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '[%H:%M:%S]', template: str = '{time} | {level} | {relpath}:{line} | {message}', colorize: bool = True) -> None\n

    Initializes the Formatter instance.

    Parameters:

    Name Type Description Default time_format str

    The format for the timestamp in log messages.

    '[%H:%M:%S]' template str

    The template for formatting log messages.

    '{time} | {level} | {relpath}:{line} | {message}' colorize bool

    Whether to colorize the log messages.

    True"},{"location":"api/#tinylogging.formatter.Formatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log message.

    "},{"location":"api/#tinylogging.helpers","title":"helpers","text":""},{"location":"api/#tinylogging.helpers.TelegramFormatter","title":"TelegramFormatter","text":"

    Bases: Formatter

    "},{"location":"api/#tinylogging.helpers.TelegramFormatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '%H:%M:%S')\n

    Initializes the TelegramFormatter with a specific time format and template.

    Parameters:

    Name Type Description Default time_format str

    The format string for formatting the time. Defaults to \"%H:%M:%S\".

    '%H:%M:%S'"},{"location":"api/#tinylogging.helpers.TelegramFormatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record into a string suitable for Telegram.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log record as a string.

    "},{"location":"api/#tinylogging.level","title":"level","text":""},{"location":"api/#tinylogging.level.Level","title":"Level","text":"

    Bases: IntEnum

    Enumeration for logging levels.

    Attributes:

    Name Type Description NOTSET

    No level set.

    TRACE

    Trace level for detailed debugging.

    DEBUG

    Debug level for general debugging.

    INFO

    Informational messages.

    NOTICE

    Notice level for normal but significant conditions.

    WARNING

    Warning level for potentially harmful situations.

    ERROR

    Error level for error events.

    CRITICAL

    Critical level for severe error events.

    "},{"location":"api/#tinylogging.record","title":"record","text":""},{"location":"api/#tinylogging.record.Record","title":"Record dataclass","text":"

    Represents a log record.

    Attributes:

    Name Type Description message str

    The log message.

    level Level

    The log level.

    name str

    The name of the logger.

    time datetime

    The time the log record was created.

    filename str

    The name of the file where the log record was created.

    line int

    The line number in the file where the log record was created.

    function str

    The function name where the log record was created.

    "},{"location":"api/#tinylogging.record.Record.basename","title":"basename property","text":"
    basename: str\n

    Gets the base name of the file where the log record was created.

    Returns:

    Name Type Description str str

    The base name of the file.

    "},{"location":"api/#tinylogging.record.Record.relpath","title":"relpath property","text":"
    relpath: str\n

    Gets the relative path of the file where the log record was created.

    Returns:

    Name Type Description str str

    The relative path of the file.

    "},{"location":"api/#tinylogging.record.Record.__post_init__","title":"__post_init__","text":"
    __post_init__() -> None\n

    Initializes additional attributes after the dataclass is created.

    Raises:

    Type Description RuntimeError

    If the stack frame cannot be retrieved.

    "},{"location":"api/#tinylogging.record.Record.to_dict","title":"to_dict","text":"
    to_dict() -> dict[str, Any]\n

    Converts the log record to a dictionary.

    Returns:

    Name Type Description dict dict[str, Any]

    A dictionary representation of the log record.

    "},{"location":"api/#tinylogging.sync","title":"sync","text":""},{"location":"api/#tinylogging.sync.Formatter","title":"Formatter","text":""},{"location":"api/#tinylogging.sync.Formatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '[%H:%M:%S]', template: str = '{time} | {level} | {relpath}:{line} | {message}', colorize: bool = True) -> None\n

    Initializes the Formatter instance.

    Parameters:

    Name Type Description Default time_format str

    The format for the timestamp in log messages.

    '[%H:%M:%S]' template str

    The template for formatting log messages.

    '{time} | {level} | {relpath}:{line} | {message}' colorize bool

    Whether to colorize the log messages.

    True"},{"location":"api/#tinylogging.sync.Formatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log message.

    "},{"location":"api/#tinylogging.sync.BaseHandler","title":"BaseHandler","text":"

    Bases: ABC

    Abstract base class for all handlers.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET"},{"location":"api/#tinylogging.sync.BaseHandler.emit","title":"emit abstractmethod","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.BaseHandler.handle","title":"handle","text":"
    handle(record: Record) -> None\n

    Handle a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.sync.FileHandler","title":"FileHandler","text":"

    Bases: BaseHandler

    Handler for writing log records to a file.

    Parameters:

    Name Type Description Default file_name str

    Name of the file to write log records to.

    required level Level

    Logging level for the handler.

    NOTSET formatter Formatter

    Formatter instance to format the log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.sync.FileHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.LoggingAdapterHandler","title":"LoggingAdapterHandler","text":"

    Bases: Handler

    Adapter handler to integrate with the standard logging module.

    Parameters:

    Name Type Description Default handler BaseHandler

    Custom handler to delegate log records to.

    required"},{"location":"api/#tinylogging.sync.LoggingAdapterHandler.emit","title":"emit","text":"
    emit(record: LogRecord) -> None\n

    Emit a log record using the custom handler.

    Parameters:

    Name Type Description Default record LogRecord

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.TelegramHandler","title":"TelegramHandler","text":"

    Bases: BaseHandler

    Handler for sending log records to a Telegram chat.

    Parameters:

    Name Type Description Default token str

    Telegram bot token.

    required chat_id int | str

    Chat ID to send messages to.

    required ignore_errors bool

    Whether to ignore errors when sending messages.

    False message_thread_id Optional[int]

    ID of the message thread.

    None **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.sync.TelegramHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.Logger","title":"Logger","text":""},{"location":"api/#tinylogging.sync.Logger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseHandler] = set()) -> None\n

    Initializes a new Logger instance.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.sync.Logger.log","title":"log","text":"
    log(message: str, level: Level) -> None\n

    Logs a message with the specified logging level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The logging level for the message.

    required"},{"location":"api/#tinylogging.sync.Logger.trace","title":"trace","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.debug","title":"debug","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.info","title":"info","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.notice","title":"notice","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.warning","title":"warning","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.error","title":"error","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.critical","title":"critical","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.sync.Logger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.sync.handlers","title":"handlers","text":""},{"location":"api/#tinylogging.sync.handlers.BaseHandler","title":"BaseHandler","text":"

    Bases: ABC

    Abstract base class for all handlers.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET"},{"location":"api/#tinylogging.sync.handlers.BaseHandler.emit","title":"emit abstractmethod","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.BaseHandler.handle","title":"handle","text":"
    handle(record: Record) -> None\n

    Handle a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.sync.handlers.StreamHandler","title":"StreamHandler","text":"

    Bases: BaseHandler

    Handler for streaming log records to a stream.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET stream Optional[TextIO]

    Stream to write log records to.

    None"},{"location":"api/#tinylogging.sync.handlers.StreamHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.FileHandler","title":"FileHandler","text":"

    Bases: BaseHandler

    Handler for writing log records to a file.

    Parameters:

    Name Type Description Default file_name str

    Name of the file to write log records to.

    required level Level

    Logging level for the handler.

    NOTSET formatter Formatter

    Formatter instance to format the log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.sync.handlers.FileHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.LoggingAdapterHandler","title":"LoggingAdapterHandler","text":"

    Bases: Handler

    Adapter handler to integrate with the standard logging module.

    Parameters:

    Name Type Description Default handler BaseHandler

    Custom handler to delegate log records to.

    required"},{"location":"api/#tinylogging.sync.handlers.LoggingAdapterHandler.emit","title":"emit","text":"
    emit(record: LogRecord) -> None\n

    Emit a log record using the custom handler.

    Parameters:

    Name Type Description Default record LogRecord

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.TelegramHandler","title":"TelegramHandler","text":"

    Bases: BaseHandler

    Handler for sending log records to a Telegram chat.

    Parameters:

    Name Type Description Default token str

    Telegram bot token.

    required chat_id int | str

    Chat ID to send messages to.

    required ignore_errors bool

    Whether to ignore errors when sending messages.

    False message_thread_id Optional[int]

    ID of the message thread.

    None **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.sync.handlers.TelegramHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"changelog/","title":"Changelog","text":"

    All notable changes to this project will be documented in this file.

    The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

    "},{"location":"changelog/#unreleased","title":"[Unreleased]","text":""},{"location":"changelog/#500-2025-01-25","title":"[5.0.0] - 2025-01-25","text":""},{"location":"changelog/#added","title":"Added","text":""},{"location":"changelog/#removed","title":"Removed","text":""},{"location":"changelog/#420-2025-01-17","title":"[4.2.0] - 2025-01-17","text":""},{"location":"changelog/#added_1","title":"Added","text":""},{"location":"changelog/#410-2025-01-17","title":"[4.1.0] - 2025-01-17","text":""},{"location":"changelog/#added_2","title":"Added","text":""},{"location":"changelog/#changed","title":"Changed","text":""},{"location":"changelog/#fixed","title":"Fixed","text":""},{"location":"changelog/#400-2025-01-14","title":"[4.0.0] - 2025-01-14","text":""},{"location":"changelog/#added_3","title":"Added","text":""},{"location":"changelog/#removed_1","title":"Removed","text":""},{"location":"changelog/#330-2025-01-11","title":"[3.3.0] - 2025-01-11","text":""},{"location":"changelog/#fixed_1","title":"Fixed","text":""},{"location":"changelog/#changed_1","title":"Changed","text":""},{"location":"changelog/#320-2024-11-01","title":"[3.2.0] - 2024-11-01","text":""},{"location":"changelog/#fixed_2","title":"Fixed","text":""},{"location":"changelog/#310-2024-10-31","title":"[3.1.0] - 2024-10-31","text":""},{"location":"changelog/#added_4","title":"Added","text":""},{"location":"changelog/#changed_2","title":"Changed","text":""},{"location":"changelog/#300-2024-10-13","title":"[3.0.0] - 2024-10-13","text":""},{"location":"changelog/#added_5","title":"Added","text":""},{"location":"changelog/#changed_3","title":"Changed","text":""},{"location":"changelog/#220-2024-10-05","title":"[2.2.0] - 2024-10-05","text":""},{"location":"changelog/#fixed_3","title":"Fixed","text":""},{"location":"changelog/#210-2024-10-05","title":"[2.1.0] - 2024-10-05","text":""},{"location":"changelog/#added_6","title":"Added","text":""},{"location":"changelog/#200-2024-10-04","title":"[2.0.0] - 2024-10-04","text":""},{"location":"changelog/#fixed_4","title":"Fixed","text":""},{"location":"changelog/#100-2024-10-04","title":"[1.0.0] - 2024-10-04","text":""},{"location":"changelog/#added_7","title":"Added","text":""}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"tinylogging","text":""},{"location":"#installation","title":"Installation","text":"
    pip install tinylogging\n
    "},{"location":"#usage","title":"Usage","text":""},{"location":"#new-logger","title":"New logger","text":"
    from tinylogging import Logger, Level\n\nlogger = Logger(name=\"my_logger\", level=Level.DEBUG)\n
    "},{"location":"#logging-messages","title":"Logging messages","text":"
    logger.info(\"This is an info message.\")\nlogger.error(\"This is an error message.\")\nlogger.debug(\"This is a debug message.\")\n
    "},{"location":"#logging-to-a-file","title":"Logging to a file","text":"
    from tinylogging import FileHandler\n\nfile_handler = FileHandler(file_name=\"app.log\", level=Level.WARNING)\nlogger.handlers.add(file_handler)\n\nlogger.warning(\"This warning will be logged to both console and file.\")\n
    "},{"location":"#custom-formatting","title":"Custom formatting","text":"
    from tinylogging import Formatter\n\nformatter = Formatter(template=\"{time} - {name} - {level} - {message}\", colorize=False)\nlogger = Logger(name=\"custom_logger\", formatter=formatter)\nlogger.info(\"This log message uses a custom format.\")\n
    "},{"location":"#disabling-logging","title":"Disabling logging","text":"
    logger.disable()\nlogger.info(\"This message will not be logged.\")\nlogger.enable()\n
    "},{"location":"#async-support","title":"Async support","text":"
    import asyncio\nfrom tinylogging import AsyncLogger, AsyncFileHandler\n\n\nasync def main():\n    logger = AsyncLogger(name=\"async_logger\")\n\n    file_handler = AsyncFileHandler(file_name=\"app.log\")\n    logger.handlers.add(file_handler)\n\n    await logger.info(\"This is an info message.\")\n    await logger.error(\"This is an error message.\")\n    await logger.debug(\"This is a debug message.\")\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main)\n
    "},{"location":"#license","title":"License","text":"

    This project is licensed under the MIT License.

    "},{"location":"api/","title":"API reference","text":""},{"location":"api/#tinylogging","title":"tinylogging","text":""},{"location":"api/#tinylogging.AsyncLogger","title":"AsyncLogger","text":""},{"location":"api/#tinylogging.AsyncLogger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseAsyncHandler] = set()) -> None\n

    Initializes an asynchronous logger.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseAsyncHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.AsyncLogger.log","title":"log async","text":"
    log(message: str, level: Level) -> None\n

    Logs a message at the specified level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The level at which to log the message.

    required"},{"location":"api/#tinylogging.AsyncLogger.trace","title":"trace async","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.debug","title":"debug async","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.info","title":"info async","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.notice","title":"notice async","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.warning","title":"warning async","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.error","title":"error async","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.critical","title":"critical async","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.AsyncLogger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.AsyncLogger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.AsyncFileHandler","title":"AsyncFileHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for writing log records to a file.

    "},{"location":"api/#tinylogging.AsyncFileHandler.__init__","title":"__init__","text":"
    __init__(file_name: str, level: Level = NOTSET, formatter: Formatter = Formatter(colorize=False)) -> None\n

    Initializes the AsyncFileHandler.

    Parameters:

    Name Type Description Default file_name str

    The name of the file to write log records to.

    required level Level

    The logging level threshold for this handler.

    NOTSET formatter Formatter

    The formatter instance to format log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.AsyncFileHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.AsyncStreamHandler","title":"AsyncStreamHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for streaming log records.

    "},{"location":"api/#tinylogging.AsyncStreamHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET, stream: Optional[AsyncFile[str]] = None) -> None\n

    Initializes the AsyncStreamHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET stream Optional[AsyncFile[str]]

    The stream to write log records to.

    None"},{"location":"api/#tinylogging.AsyncStreamHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.AsyncTelegramHandler","title":"AsyncTelegramHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for sending log records to a Telegram chat.

    "},{"location":"api/#tinylogging.AsyncTelegramHandler.__init__","title":"__init__","text":"
    __init__(token: str, chat_id: int | str, message_thread_id: Optional[int] = None, ignore_errors: bool = False, **kwargs: Any) -> None\n

    Initializes the AsyncTelegramHandler.

    Parameters:

    Name Type Description Default token str

    The Telegram bot token.

    required chat_id int | str

    The chat ID to send log records to.

    required message_thread_id Optional[int]

    The message thread ID (optional).

    None ignore_errors bool

    Whether to ignore errors during sending.

    False **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.AsyncTelegramHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.BaseAsyncHandler","title":"BaseAsyncHandler","text":"

    Bases: ABC

    Base class for all async handlers.

    "},{"location":"api/#tinylogging.BaseAsyncHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET) -> None\n

    Initializes the BaseAsyncHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET"},{"location":"api/#tinylogging.BaseAsyncHandler.emit","title":"emit abstractmethod async","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required

    Raises:

    Type Description NotImplementedError

    This method should be overridden by subclasses.

    "},{"location":"api/#tinylogging.BaseAsyncHandler.handle","title":"handle async","text":"
    handle(record: Record) -> None\n

    Handle a log record if it meets the logging level threshold.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.Formatter","title":"Formatter","text":""},{"location":"api/#tinylogging.Formatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '[%H:%M:%S]', template: str = '{time} | {level} | {relpath}:{line} | {message}', colorize: bool = True) -> None\n

    Initializes the Formatter instance.

    Parameters:

    Name Type Description Default time_format str

    The format for the timestamp in log messages.

    '[%H:%M:%S]' template str

    The template for formatting log messages.

    '{time} | {level} | {relpath}:{line} | {message}' colorize bool

    Whether to colorize the log messages.

    True"},{"location":"api/#tinylogging.Formatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log message.

    "},{"location":"api/#tinylogging.Level","title":"Level","text":"

    Bases: IntEnum

    Enumeration for logging levels.

    Attributes:

    Name Type Description NOTSET

    No level set.

    TRACE

    Trace level for detailed debugging.

    DEBUG

    Debug level for general debugging.

    INFO

    Informational messages.

    NOTICE

    Notice level for normal but significant conditions.

    WARNING

    Warning level for potentially harmful situations.

    ERROR

    Error level for error events.

    CRITICAL

    Critical level for severe error events.

    "},{"location":"api/#tinylogging.Record","title":"Record dataclass","text":"

    Represents a log record.

    Attributes:

    Name Type Description message str

    The log message.

    level Level

    The log level.

    name str

    The name of the logger.

    time datetime

    The time the log record was created.

    filename str

    The name of the file where the log record was created.

    line int

    The line number in the file where the log record was created.

    function str

    The function name where the log record was created.

    "},{"location":"api/#tinylogging.Record.basename","title":"basename property","text":"
    basename: str\n

    Gets the base name of the file where the log record was created.

    Returns:

    Name Type Description str str

    The base name of the file.

    "},{"location":"api/#tinylogging.Record.relpath","title":"relpath property","text":"
    relpath: str\n

    Gets the relative path of the file where the log record was created.

    Returns:

    Name Type Description str str

    The relative path of the file.

    "},{"location":"api/#tinylogging.Record.__post_init__","title":"__post_init__","text":"
    __post_init__() -> None\n

    Initializes additional attributes after the dataclass is created.

    Raises:

    Type Description RuntimeError

    If the stack frame cannot be retrieved.

    "},{"location":"api/#tinylogging.Record.to_dict","title":"to_dict","text":"
    to_dict() -> dict[str, Any]\n

    Converts the log record to a dictionary.

    Returns:

    Name Type Description dict dict[str, Any]

    A dictionary representation of the log record.

    "},{"location":"api/#tinylogging.Logger","title":"Logger","text":""},{"location":"api/#tinylogging.Logger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseHandler] = set()) -> None\n

    Initializes a new Logger instance.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.Logger.log","title":"log","text":"
    log(message: str, level: Level) -> None\n

    Logs a message with the specified logging level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The logging level for the message.

    required"},{"location":"api/#tinylogging.Logger.trace","title":"trace","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.debug","title":"debug","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.info","title":"info","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.notice","title":"notice","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.warning","title":"warning","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.error","title":"error","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.critical","title":"critical","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.Logger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.Logger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.BaseHandler","title":"BaseHandler","text":"

    Bases: ABC

    Abstract base class for all handlers.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET"},{"location":"api/#tinylogging.BaseHandler.emit","title":"emit abstractmethod","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.BaseHandler.handle","title":"handle","text":"
    handle(record: Record) -> None\n

    Handle a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.FileHandler","title":"FileHandler","text":"

    Bases: BaseHandler

    Handler for writing log records to a file.

    Parameters:

    Name Type Description Default file_name str

    Name of the file to write log records to.

    required level Level

    Logging level for the handler.

    NOTSET formatter Formatter

    Formatter instance to format the log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.FileHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.LoggingAdapterHandler","title":"LoggingAdapterHandler","text":"

    Bases: Handler

    Adapter handler to integrate with the standard logging module.

    Parameters:

    Name Type Description Default handler BaseHandler

    Custom handler to delegate log records to.

    required"},{"location":"api/#tinylogging.LoggingAdapterHandler.emit","title":"emit","text":"
    emit(record: LogRecord) -> None\n

    Emit a log record using the custom handler.

    Parameters:

    Name Type Description Default record LogRecord

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.StreamHandler","title":"StreamHandler","text":"

    Bases: BaseHandler

    Handler for streaming log records to a stream.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET stream Optional[TextIO]

    Stream to write log records to.

    None"},{"location":"api/#tinylogging.StreamHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.TelegramHandler","title":"TelegramHandler","text":"

    Bases: BaseHandler

    Handler for sending log records to a Telegram chat.

    Parameters:

    Name Type Description Default token str

    Telegram bot token.

    required chat_id int | str

    Chat ID to send messages to.

    required ignore_errors bool

    Whether to ignore errors when sending messages.

    False message_thread_id Optional[int]

    ID of the message thread.

    None **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.TelegramHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio","title":"aio","text":""},{"location":"api/#tinylogging.aio.AsyncFileHandler","title":"AsyncFileHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for writing log records to a file.

    "},{"location":"api/#tinylogging.aio.AsyncFileHandler.__init__","title":"__init__","text":"
    __init__(file_name: str, level: Level = NOTSET, formatter: Formatter = Formatter(colorize=False)) -> None\n

    Initializes the AsyncFileHandler.

    Parameters:

    Name Type Description Default file_name str

    The name of the file to write log records to.

    required level Level

    The logging level threshold for this handler.

    NOTSET formatter Formatter

    The formatter instance to format log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.aio.AsyncFileHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.AsyncTelegramHandler","title":"AsyncTelegramHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for sending log records to a Telegram chat.

    "},{"location":"api/#tinylogging.aio.AsyncTelegramHandler.__init__","title":"__init__","text":"
    __init__(token: str, chat_id: int | str, message_thread_id: Optional[int] = None, ignore_errors: bool = False, **kwargs: Any) -> None\n

    Initializes the AsyncTelegramHandler.

    Parameters:

    Name Type Description Default token str

    The Telegram bot token.

    required chat_id int | str

    The chat ID to send log records to.

    required message_thread_id Optional[int]

    The message thread ID (optional).

    None ignore_errors bool

    Whether to ignore errors during sending.

    False **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.aio.AsyncTelegramHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.BaseAsyncHandler","title":"BaseAsyncHandler","text":"

    Bases: ABC

    Base class for all async handlers.

    "},{"location":"api/#tinylogging.aio.BaseAsyncHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET) -> None\n

    Initializes the BaseAsyncHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET"},{"location":"api/#tinylogging.aio.BaseAsyncHandler.emit","title":"emit abstractmethod async","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required

    Raises:

    Type Description NotImplementedError

    This method should be overridden by subclasses.

    "},{"location":"api/#tinylogging.aio.BaseAsyncHandler.handle","title":"handle async","text":"
    handle(record: Record) -> None\n

    Handle a log record if it meets the logging level threshold.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger","title":"AsyncLogger","text":""},{"location":"api/#tinylogging.aio.AsyncLogger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseAsyncHandler] = set()) -> None\n

    Initializes an asynchronous logger.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseAsyncHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.aio.AsyncLogger.log","title":"log async","text":"
    log(message: str, level: Level) -> None\n

    Logs a message at the specified level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The level at which to log the message.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.trace","title":"trace async","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.debug","title":"debug async","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.info","title":"info async","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.notice","title":"notice async","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.warning","title":"warning async","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.error","title":"error async","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.critical","title":"critical async","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.aio.AsyncLogger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.aio.AsyncLogger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.aio.handlers","title":"handlers","text":""},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler","title":"BaseAsyncHandler","text":"

    Bases: ABC

    Base class for all async handlers.

    "},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET) -> None\n

    Initializes the BaseAsyncHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET"},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler.emit","title":"emit abstractmethod async","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required

    Raises:

    Type Description NotImplementedError

    This method should be overridden by subclasses.

    "},{"location":"api/#tinylogging.aio.handlers.BaseAsyncHandler.handle","title":"handle async","text":"
    handle(record: Record) -> None\n

    Handle a log record if it meets the logging level threshold.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.aio.handlers.AsyncStreamHandler","title":"AsyncStreamHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for streaming log records.

    "},{"location":"api/#tinylogging.aio.handlers.AsyncStreamHandler.__init__","title":"__init__","text":"
    __init__(formatter: Formatter = Formatter(), level: Level = NOTSET, stream: Optional[AsyncFile[str]] = None) -> None\n

    Initializes the AsyncStreamHandler.

    Parameters:

    Name Type Description Default formatter Formatter

    The formatter instance to format log records.

    Formatter() level Level

    The logging level threshold for this handler.

    NOTSET stream Optional[AsyncFile[str]]

    The stream to write log records to.

    None"},{"location":"api/#tinylogging.aio.handlers.AsyncStreamHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.handlers.AsyncFileHandler","title":"AsyncFileHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for writing log records to a file.

    "},{"location":"api/#tinylogging.aio.handlers.AsyncFileHandler.__init__","title":"__init__","text":"
    __init__(file_name: str, level: Level = NOTSET, formatter: Formatter = Formatter(colorize=False)) -> None\n

    Initializes the AsyncFileHandler.

    Parameters:

    Name Type Description Default file_name str

    The name of the file to write log records to.

    required level Level

    The logging level threshold for this handler.

    NOTSET formatter Formatter

    The formatter instance to format log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.aio.handlers.AsyncFileHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.aio.handlers.AsyncTelegramHandler","title":"AsyncTelegramHandler","text":"

    Bases: BaseAsyncHandler

    Asynchronous handler for sending log records to a Telegram chat.

    "},{"location":"api/#tinylogging.aio.handlers.AsyncTelegramHandler.__init__","title":"__init__","text":"
    __init__(token: str, chat_id: int | str, message_thread_id: Optional[int] = None, ignore_errors: bool = False, **kwargs: Any) -> None\n

    Initializes the AsyncTelegramHandler.

    Parameters:

    Name Type Description Default token str

    The Telegram bot token.

    required chat_id int | str

    The chat ID to send log records to.

    required message_thread_id Optional[int]

    The message thread ID (optional).

    None ignore_errors bool

    Whether to ignore errors during sending.

    False **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.aio.handlers.AsyncTelegramHandler.emit","title":"emit async","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.formatter","title":"formatter","text":""},{"location":"api/#tinylogging.formatter.Formatter","title":"Formatter","text":""},{"location":"api/#tinylogging.formatter.Formatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '[%H:%M:%S]', template: str = '{time} | {level} | {relpath}:{line} | {message}', colorize: bool = True) -> None\n

    Initializes the Formatter instance.

    Parameters:

    Name Type Description Default time_format str

    The format for the timestamp in log messages.

    '[%H:%M:%S]' template str

    The template for formatting log messages.

    '{time} | {level} | {relpath}:{line} | {message}' colorize bool

    Whether to colorize the log messages.

    True"},{"location":"api/#tinylogging.formatter.Formatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log message.

    "},{"location":"api/#tinylogging.helpers","title":"helpers","text":""},{"location":"api/#tinylogging.helpers.TelegramFormatter","title":"TelegramFormatter","text":"

    Bases: Formatter

    "},{"location":"api/#tinylogging.helpers.TelegramFormatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '%H:%M:%S')\n

    Initializes the TelegramFormatter with a specific time format and template.

    Parameters:

    Name Type Description Default time_format str

    The format string for formatting the time. Defaults to \"%H:%M:%S\".

    '%H:%M:%S'"},{"location":"api/#tinylogging.helpers.TelegramFormatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record into a string suitable for Telegram.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log record as a string.

    "},{"location":"api/#tinylogging.level","title":"level","text":""},{"location":"api/#tinylogging.level.Level","title":"Level","text":"

    Bases: IntEnum

    Enumeration for logging levels.

    Attributes:

    Name Type Description NOTSET

    No level set.

    TRACE

    Trace level for detailed debugging.

    DEBUG

    Debug level for general debugging.

    INFO

    Informational messages.

    NOTICE

    Notice level for normal but significant conditions.

    WARNING

    Warning level for potentially harmful situations.

    ERROR

    Error level for error events.

    CRITICAL

    Critical level for severe error events.

    "},{"location":"api/#tinylogging.record","title":"record","text":""},{"location":"api/#tinylogging.record.Record","title":"Record dataclass","text":"

    Represents a log record.

    Attributes:

    Name Type Description message str

    The log message.

    level Level

    The log level.

    name str

    The name of the logger.

    time datetime

    The time the log record was created.

    filename str

    The name of the file where the log record was created.

    line int

    The line number in the file where the log record was created.

    function str

    The function name where the log record was created.

    "},{"location":"api/#tinylogging.record.Record.basename","title":"basename property","text":"
    basename: str\n

    Gets the base name of the file where the log record was created.

    Returns:

    Name Type Description str str

    The base name of the file.

    "},{"location":"api/#tinylogging.record.Record.relpath","title":"relpath property","text":"
    relpath: str\n

    Gets the relative path of the file where the log record was created.

    Returns:

    Name Type Description str str

    The relative path of the file.

    "},{"location":"api/#tinylogging.record.Record.__post_init__","title":"__post_init__","text":"
    __post_init__() -> None\n

    Initializes additional attributes after the dataclass is created.

    Raises:

    Type Description RuntimeError

    If the stack frame cannot be retrieved.

    "},{"location":"api/#tinylogging.record.Record.to_dict","title":"to_dict","text":"
    to_dict() -> dict[str, Any]\n

    Converts the log record to a dictionary.

    Returns:

    Name Type Description dict dict[str, Any]

    A dictionary representation of the log record.

    "},{"location":"api/#tinylogging.sync","title":"sync","text":""},{"location":"api/#tinylogging.sync.Formatter","title":"Formatter","text":""},{"location":"api/#tinylogging.sync.Formatter.__init__","title":"__init__","text":"
    __init__(time_format: str = '[%H:%M:%S]', template: str = '{time} | {level} | {relpath}:{line} | {message}', colorize: bool = True) -> None\n

    Initializes the Formatter instance.

    Parameters:

    Name Type Description Default time_format str

    The format for the timestamp in log messages.

    '[%H:%M:%S]' template str

    The template for formatting log messages.

    '{time} | {level} | {relpath}:{line} | {message}' colorize bool

    Whether to colorize the log messages.

    True"},{"location":"api/#tinylogging.sync.Formatter.format","title":"format","text":"
    format(record: Record) -> str\n

    Formats a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to format.

    required

    Returns:

    Name Type Description str str

    The formatted log message.

    "},{"location":"api/#tinylogging.sync.BaseHandler","title":"BaseHandler","text":"

    Bases: ABC

    Abstract base class for all handlers.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET"},{"location":"api/#tinylogging.sync.BaseHandler.emit","title":"emit abstractmethod","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.BaseHandler.handle","title":"handle","text":"
    handle(record: Record) -> None\n

    Handle a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.sync.FileHandler","title":"FileHandler","text":"

    Bases: BaseHandler

    Handler for writing log records to a file.

    Parameters:

    Name Type Description Default file_name str

    Name of the file to write log records to.

    required level Level

    Logging level for the handler.

    NOTSET formatter Formatter

    Formatter instance to format the log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.sync.FileHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.LoggingAdapterHandler","title":"LoggingAdapterHandler","text":"

    Bases: Handler

    Adapter handler to integrate with the standard logging module.

    Parameters:

    Name Type Description Default handler BaseHandler

    Custom handler to delegate log records to.

    required"},{"location":"api/#tinylogging.sync.LoggingAdapterHandler.emit","title":"emit","text":"
    emit(record: LogRecord) -> None\n

    Emit a log record using the custom handler.

    Parameters:

    Name Type Description Default record LogRecord

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.TelegramHandler","title":"TelegramHandler","text":"

    Bases: BaseHandler

    Handler for sending log records to a Telegram chat.

    Parameters:

    Name Type Description Default token str

    Telegram bot token.

    required chat_id int | str

    Chat ID to send messages to.

    required ignore_errors bool

    Whether to ignore errors when sending messages.

    False message_thread_id Optional[int]

    ID of the message thread.

    None **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.sync.TelegramHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.Logger","title":"Logger","text":""},{"location":"api/#tinylogging.sync.Logger.__init__","title":"__init__","text":"
    __init__(name: str, level: Level = NOTSET, formatter: Formatter = Formatter(), handlers: set[BaseHandler] = set()) -> None\n

    Initializes a new Logger instance.

    Parameters:

    Name Type Description Default name str

    The name of the logger.

    required level Level

    The logging level. Defaults to Level.NOTSET.

    NOTSET formatter Formatter

    The formatter for log messages. Defaults to Formatter().

    Formatter() handlers set[BaseHandler]

    A set of handlers for the logger. Defaults to an empty set.

    set()"},{"location":"api/#tinylogging.sync.Logger.log","title":"log","text":"
    log(message: str, level: Level) -> None\n

    Logs a message with the specified logging level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required level Level

    The logging level for the message.

    required"},{"location":"api/#tinylogging.sync.Logger.trace","title":"trace","text":"
    trace(message: str) -> None\n

    Logs a message with TRACE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.debug","title":"debug","text":"
    debug(message: str) -> None\n

    Logs a message with DEBUG level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.info","title":"info","text":"
    info(message: str) -> None\n

    Logs a message with INFO level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.notice","title":"notice","text":"
    notice(message: str) -> None\n

    Logs a message with NOTICE level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.warning","title":"warning","text":"
    warning(message: str) -> None\n

    Logs a message with WARNING level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.error","title":"error","text":"
    error(message: str) -> None\n

    Logs a message with ERROR level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.critical","title":"critical","text":"
    critical(message: str) -> None\n

    Logs a message with CRITICAL level.

    Parameters:

    Name Type Description Default message str

    The message to log.

    required"},{"location":"api/#tinylogging.sync.Logger.enable","title":"enable","text":"
    enable() -> None\n

    Enables the logger.

    "},{"location":"api/#tinylogging.sync.Logger.disable","title":"disable","text":"
    disable() -> None\n

    Disables the logger.

    "},{"location":"api/#tinylogging.sync.handlers","title":"handlers","text":""},{"location":"api/#tinylogging.sync.handlers.BaseHandler","title":"BaseHandler","text":"

    Bases: ABC

    Abstract base class for all handlers.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET"},{"location":"api/#tinylogging.sync.handlers.BaseHandler.emit","title":"emit abstractmethod","text":"
    emit(record: Record) -> None\n

    Emit a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.BaseHandler.handle","title":"handle","text":"
    handle(record: Record) -> None\n

    Handle a log record.

    Parameters:

    Name Type Description Default record Record

    The log record to be handled.

    required"},{"location":"api/#tinylogging.sync.handlers.StreamHandler","title":"StreamHandler","text":"

    Bases: BaseHandler

    Handler for streaming log records to a stream.

    Parameters:

    Name Type Description Default formatter Formatter

    Formatter instance to format the log records.

    Formatter() level Level

    Logging level for the handler.

    NOTSET stream Optional[TextIO]

    Stream to write log records to.

    None"},{"location":"api/#tinylogging.sync.handlers.StreamHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the stream.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.FileHandler","title":"FileHandler","text":"

    Bases: BaseHandler

    Handler for writing log records to a file.

    Parameters:

    Name Type Description Default file_name str

    Name of the file to write log records to.

    required level Level

    Logging level for the handler.

    NOTSET formatter Formatter

    Formatter instance to format the log records.

    Formatter(colorize=False)"},{"location":"api/#tinylogging.sync.handlers.FileHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the file.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.LoggingAdapterHandler","title":"LoggingAdapterHandler","text":"

    Bases: Handler

    Adapter handler to integrate with the standard logging module.

    Parameters:

    Name Type Description Default handler BaseHandler

    Custom handler to delegate log records to.

    required"},{"location":"api/#tinylogging.sync.handlers.LoggingAdapterHandler.emit","title":"emit","text":"
    emit(record: LogRecord) -> None\n

    Emit a log record using the custom handler.

    Parameters:

    Name Type Description Default record LogRecord

    The log record to be emitted.

    required"},{"location":"api/#tinylogging.sync.handlers.TelegramHandler","title":"TelegramHandler","text":"

    Bases: BaseHandler

    Handler for sending log records to a Telegram chat.

    Parameters:

    Name Type Description Default token str

    Telegram bot token.

    required chat_id int | str

    Chat ID to send messages to.

    required ignore_errors bool

    Whether to ignore errors when sending messages.

    False message_thread_id Optional[int]

    ID of the message thread.

    None **kwargs Any

    Additional keyword arguments for the base handler.

    {}"},{"location":"api/#tinylogging.sync.handlers.TelegramHandler.emit","title":"emit","text":"
    emit(record: Record) -> None\n

    Emit a log record to the Telegram chat.

    Parameters:

    Name Type Description Default record Record

    The log record to be emitted.

    required"},{"location":"changelog/","title":"Changelog","text":"

    All notable changes to this project will be documented in this file.

    The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

    "},{"location":"changelog/#unreleased","title":"[Unreleased]","text":""},{"location":"changelog/#changed","title":"Changed","text":""},{"location":"changelog/#500-2025-01-25","title":"[5.0.0] - 2025-01-25","text":""},{"location":"changelog/#added","title":"Added","text":""},{"location":"changelog/#removed","title":"Removed","text":""},{"location":"changelog/#420-2025-01-17","title":"[4.2.0] - 2025-01-17","text":""},{"location":"changelog/#added_1","title":"Added","text":""},{"location":"changelog/#410-2025-01-17","title":"[4.1.0] - 2025-01-17","text":""},{"location":"changelog/#added_2","title":"Added","text":""},{"location":"changelog/#changed_1","title":"Changed","text":""},{"location":"changelog/#fixed","title":"Fixed","text":""},{"location":"changelog/#400-2025-01-14","title":"[4.0.0] - 2025-01-14","text":""},{"location":"changelog/#added_3","title":"Added","text":""},{"location":"changelog/#removed_1","title":"Removed","text":""},{"location":"changelog/#330-2025-01-11","title":"[3.3.0] - 2025-01-11","text":""},{"location":"changelog/#fixed_1","title":"Fixed","text":""},{"location":"changelog/#changed_2","title":"Changed","text":""},{"location":"changelog/#320-2024-11-01","title":"[3.2.0] - 2024-11-01","text":""},{"location":"changelog/#fixed_2","title":"Fixed","text":""},{"location":"changelog/#310-2024-10-31","title":"[3.1.0] - 2024-10-31","text":""},{"location":"changelog/#added_4","title":"Added","text":""},{"location":"changelog/#changed_3","title":"Changed","text":""},{"location":"changelog/#300-2024-10-13","title":"[3.0.0] - 2024-10-13","text":""},{"location":"changelog/#added_5","title":"Added","text":""},{"location":"changelog/#changed_4","title":"Changed","text":""},{"location":"changelog/#220-2024-10-05","title":"[2.2.0] - 2024-10-05","text":""},{"location":"changelog/#fixed_3","title":"Fixed","text":""},{"location":"changelog/#210-2024-10-05","title":"[2.1.0] - 2024-10-05","text":""},{"location":"changelog/#added_6","title":"Added","text":""},{"location":"changelog/#200-2024-10-04","title":"[2.0.0] - 2024-10-04","text":""},{"location":"changelog/#fixed_4","title":"Fixed","text":""},{"location":"changelog/#100-2024-10-04","title":"[1.0.0] - 2024-10-04","text":""},{"location":"changelog/#added_7","title":"Added","text":""}]} \ No newline at end of file