duplicity.log module

Log various messages depending on verbosity level

duplicity.log.Debug(s)[source]

Shortcut used for debug message (verbosity 9).

class duplicity.log.DetailFormatter[source]

Bases: Formatter

Formatter that creates messages in a syntax somewhat like syslog.

__init__()[source]

Initialize the formatter with specified format strings.

Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.

Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting, str.format() ({}) formatting or string.Template formatting in your format string.

Changed in version 3.2: Added the style parameter.

format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

duplicity.log.DupToLoggerLevel(verb)[source]

Convert duplicity level to the logging module’s system, where higher is more severe

class duplicity.log.ErrFilter(name='')[source]

Bases: Filter

Filter that only allows messages more important than warnings

filter(record)[source]

Determine if the specified record is to be logged.

Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place.

duplicity.log.Error(s, code=1, extra=None)[source]

Write error message

class duplicity.log.ErrorCode[source]

Bases: object

Enumeration class to hold error code values. These values should never change, as frontends rely upon them. Don’t use 0 or negative numbers. This code is returned by duplicity to indicate which error occurred via both exit code and log.

absolute_files_from = 72
backend_code_error = 55
backend_command_error = 54
backend_error = 50
backend_no_space = 53
backend_not_found = 52
backend_permission_denied = 51
backup_dir_doesnt_exist = 13
bad_archive_dir = 9
bad_request = 48
bad_sign_key = 10
bad_url = 8
boto_calling_format = 26
boto_lib_too_old = 25
boto_old_style = 24
cant_open_filelist = 7
command_line = 2
connection_failed = 38
dpbx_nologin = 47
empty_files_from = 73
enryption_mismatch = 45
exception = 30
file_prefix_error = 14
ftp_ncftp_missing = 27
ftp_ncftp_too_old = 28
ftps_lftp_missing = 43
generic = 1
get_freespace_failed = 34
get_ulimit_failed = 36
gio_not_available = 40
globbing_error = 15
gpg_failed = 31
hostname_mismatch = 3
inc_without_sigs = 17
maxopen_too_low = 37
mismatched_hash = 21
mismatched_manifests = 5
no_manifests = 4
no_restore_files = 20
no_sigs = 18
not_enough_freespace = 35
not_implemented = 33
pythonoptimize_set = 46
redundant_filter = 70
redundant_inclusion = 16
restart_file_not_found = 39
restore_dir_exists = 11
restore_dir_not_found = 19
s3_bucket_not_style = 32
s3_kms_no_id = 49
source_dir_mismatch = 42
trailing_filter = 71
unreadable_manifests = 6
unsigned_volume = 22
user_error = 23
verify_dir_doesnt_exist = 12
volume_wrong_size = 44
duplicity.log.FatalError(s, code=1, extra=None)[source]

Write fatal error message and exit

duplicity.log.Info(s, code=1, extra=None)[source]

Shortcut used for info messages (verbosity 5).

class duplicity.log.InfoCode[source]

Bases: object

Enumeration class to hold info code values. These values should never change, as frontends rely upon them. Don’t use 0 or negative numbers.

asynchronous_upload_begin = 12
asynchronous_upload_done = 14
collection_status = 3
diff_file_changed = 5
diff_file_deleted = 6
diff_file_new = 4
file_list = 10
generic = 1
patch_file_patching = 8
patch_file_writing = 7
progress = 2
skipping_socket = 15
synchronous_upload_begin = 11
synchronous_upload_done = 13
upload_progress = 16
duplicity.log.LevelName(level)[source]
duplicity.log.Log(s, verb_level, code=1, extra=None, force_print=False, transfer_progress=False)[source]

Write s to stderr if verbosity level low enough

duplicity.log.LoggerToDupLevel(verb)[source]

Convert logging module level to duplicity’s system, where lower is more severe

class duplicity.log.MachineFilter(name='')[source]

Bases: Filter

Filter that only allows levels that are consumable by other processes.

filter(record)[source]

Determine if the specified record is to be logged.

Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place.

class duplicity.log.MachineFormatter[source]

Bases: Formatter

Formatter that creates messages in a syntax easily consumable by other processes.

__init__()[source]

Initialize the formatter with specified format strings.

Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.

Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting, str.format() ({}) formatting or string.Template formatting in your format string.

Changed in version 3.2: Added the style parameter.

format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

duplicity.log.Notice(s)[source]

Shortcut used for notice messages (verbosity 3, the default).

class duplicity.log.OutFilter(name='')[source]

Bases: Filter

Filter that only allows warning or less important messages

filter(record)[source]

Determine if the specified record is to be logged.

Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place.

class duplicity.log.PrettyProgressFormatter[source]

Bases: Formatter

Formatter that overwrites previous progress lines on ANSI terminals

__init__()[source]

Initialize the formatter with specified format strings.

Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.

Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting, str.format() ({}) formatting or string.Template formatting in your format string.

Changed in version 3.2: Added the style parameter.

format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

last_record_was_progress = False
duplicity.log.PrintCollectionChangesInSet(col_stats, set_index, force_print=False)[source]

Prints changes in the specified set to the log

duplicity.log.PrintCollectionFileChangedStatus(col_stats, filepath, force_print=False)[source]

Prints a collection status to the log

duplicity.log.PrintCollectionStatus(col_stats, force_print=False)[source]

Prints a collection status to the log

duplicity.log.Progress(s, current, total=None)[source]

Shortcut used for progress messages (verbosity 5).

duplicity.log.TransferProgress(progress, eta, changed_bytes, elapsed, speed, stalled)[source]

Shortcut used for upload progress messages (verbosity 5).

duplicity.log.Warn(s, code=1, extra=None)[source]

Shortcut used for warning messages (verbosity 2)

class duplicity.log.WarningCode[source]

Bases: object

Enumeration class to hold warning code values. These values should never change, as frontends rely upon them. Don’t use 0 or negative numbers.

cannot_iterate = 8
cannot_process = 12
cannot_read = 10
cannot_stat = 9
ftp_ncftp_v320 = 7
generic = 1
incomplete_backup = 5
no_sig_for_time = 11
orphaned_backup = 6
orphaned_sig = 2
process_skipped = 13
unmatched_sig = 4
unnecessary_sig = 3
duplicity.log._ElapsedSecs2Str(secs)[source]
duplicity.log._RemainingSecs2Str(secs)[source]
duplicity.log.add_fd(fd)[source]

Add stream to which to write machine-readable logging

duplicity.log.add_file(filename)[source]

Add file to which to write machine-readable logging

duplicity.log.getverbosity()[source]

Get the verbosity level

duplicity.log.setup()[source]

Initialize logging

duplicity.log.setverbosity(verb)[source]

Set the verbosity level

duplicity.log.shutdown()[source]

Cleanup and flush loggers