Other utility functions that don’t fit into any of the specific modules.

exception sailor.utils.utils.DataNotFoundWarning(message=None)[source]

Bases: Warning

Use this warning to indicate that a query-like function returned an empty result.

class sailor.utils.utils.WarningAdapter(logger, extra=None)[source]

Bases: LoggerAdapter

Allow a logger to convert warnings logs into real warnings to simplify logging setup for users.

critical(msg, *args, **kwargs)

Delegate a critical call to the underlying logger.

debug(msg, *args, **kwargs)

Delegate a debug call to the underlying logger.

error(msg, *args, **kwargs)

Delegate an error call to the underlying logger.

exception(msg, *args, exc_info=True, **kwargs)

Delegate an exception call to the underlying logger.


Get the effective level for the underlying logger.


See if the underlying logger has any handlers.

info(msg, *args, **kwargs)

Delegate an info call to the underlying logger.


Is this logger enabled for level ‘level’?

log(level, msg, *args, **kwargs)[source]

Delegate a log call to LoggerAdapter.log, after adjusting the stacklevel for introduced stack layers.

log_with_warning(msg, warning_stacklevel=1, warning_category=None)[source]

Delegate a warning call to the underlying logger and trigger a real warning with the same message.

process(msg, kwargs)

Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.

Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.


Set the specified level on the underlying logger.

warning(msg, *args, **kwargs)

Delegate a warning call to the underlying logger.