API Documentation

class borg.lrucache.LRUCache(capacity, dispose)[source]
clear()[source]
items()[source]

A basic extended attributes (xattr) implementation for Linux and MacOS X

borg.xattr.get_all(path, follow_symlinks=True)[source]
borg.xattr.getxattr(path, name, *, follow_symlinks=True)[source]
borg.xattr.is_enabled(path=None)[source]

Determine if xattr is enabled on the filesystem

borg.xattr.listxattr(path, *, follow_symlinks=True)[source]
borg.xattr.setxattr(path, name, value, *, follow_symlinks=True)[source]

logging facilities

The way to use this is as follows:

  • each module declares its own logger, using:

    from .logger import create_logger logger = create_logger()

  • then each module uses logger.info/warning/debug/etc according to the level it believes is appropriate:

    logger.debug(‘debugging info for developers or power users’) logger.info(‘normal, informational output’) logger.warning(‘warn about a non-fatal error or sth else’) logger.error(‘a fatal error’)

    ... and so on. see the logging documentation for more information

  • console interaction happens on stderr, that includes interactive reporting functions like help, info and list

  • ...except input() is special, because we can’t control the stream it is using, unfortunately. we assume that it won’t clutter stdout, because interaction would be broken then anyways

  • what is output on INFO level is additionally controlled by commandline flags

borg.logger.create_logger(name=None)[source]

create a Logger object with the proper path, which is returned by find_parent_module() by default, or is provided via the commandline

this is really a shortcut for:

logger = logging.getLogger(__name__)

we use it to avoid errors and provide a more standard API.

borg.logger.find_parent_module()[source]

find the name of a the first module calling this module

if we cannot find it, we return the current module’s name (__name__) instead.

borg.logger.setup_logging(stream=None)[source]

setup logging module according to the arguments provided

this sets up a stream handler logger on stderr (by default, if no stream is provided).