snapshotlog module
- class snapshotlog.LogFilter(mode=0, decode=None)[source]
Bases:
object
A Filter for snapshot logs which will both decode log lines and filter them for the requested
mode
.- Parameters:
mode (int) – which filter should be used. Possible values:
NO_FILTER
,ERROR
,CHANGES
,INFORMATION
orERROR_AND_CHANGES
decode (encfstools.Decode) – instance used for decoding lines or
None
- CHANGES = 2
- ERROR = 1
- ERROR_AND_CHANGES = 4
- INFORMATION = 3
- NO_FILTER = 0
- REGEX = {0: None, 1: re.compile('^(?:\\[E\\]|[^\\[])'), 2: re.compile('^(?:\\[C\\]|[^\\[])'), 3: re.compile('^(?:\\[I\\]|[^\\[])'), 4: re.compile('^(?:\\[E\\]|\\[C\\]|[^\\[])'), 5: re.compile('.*(?:Invalid cross-device link|symlink has no referent|readlink_stat\\(.?\\) failed|link_stat .* failed|receive_sums failed|send_files failed to open|fstat failed|read errors mapping|change_dir .* fa), None: None}
- RSYNC_TRANSFER_FAILURES = 5
- class snapshotlog.SnapshotLog(cfg, profile=None)[source]
Bases:
object
Read and write Snapshot log to “~/.local/share/backintime/takesnapshot_<N>.log”. Where <N> is the profile ID
profile
.- Parameters:
cfg (config.Config) – current config
profile (int) – profile that should be used to identify the log
- ALL = 3
- CHANGES_AND_ERRORS = 2
- ERRORS = 1
- NONE = 0
- append(msg, level)[source]
Append
msg
to the log iflevel
is lower than configured log level.- Parameters:
msg (str) – message line that should be added to the log
level (int) – verbosity level of current line. msg will only be added to log if level is lower than configured log level
config.Config.logLevel()
. Possible Values:SnapshotLog.ERRORS
,SnapshotLog.CHANGES_AND_ERRORS
orSnapshotLog.ALL
- get(mode=None, decode=None, skipLines=0)[source]
Read the log, filter and decode it and yield its lines.
- Parameters:
mode (int) – Mode used for filtering. Take a look at
snapshotlog.LogFilter
decode (encfstools.Decode) – instance used for decoding lines or
None
skipLines (int) – skip
n
lines before yielding lines. This is used to append only new lines to LogView
- Yields:
str – filtered and decoded log lines
- new(date)[source]
Create a new log file or - if the last new_snapshot can be continued - add a note to the current log.
- Parameters:
date (datetime.datetime) – current date