~ubuntu-branches/ubuntu/natty/duplicity/natty-updates

« back to all changes in this revision

Viewing changes to src/log.py

  • Committer: Michael Terry
  • Date: 2010-01-09 02:53:42 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: mike@mterry.name-20100109025342-ttfcjl4i0kcwejf0
Merging shared upstream rev into target branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        initial_level = _logger.getEffectiveLevel()
63
63
        _logger.setLevel(DupToLoggerLevel(MAX))
64
64
 
65
 
    _logger.log(DupToLoggerLevel(verb_level), s)
 
65
    _logger.log(DupToLoggerLevel(verb_level), s.decode("utf8", "ignore"))
66
66
    _logger.controlLine = None
67
67
 
68
68
    if force_print:
86
86
    patch_file_patching = 8
87
87
    #file_list = 9 # 9 isn't used anymore.  It corresponds to an older syntax for listing files
88
88
    file_list = 10
 
89
    synchronous_upload_begin = 11
 
90
    asynchronous_upload_begin = 12
 
91
    synchronous_upload_done = 13
 
92
    asynchronous_upload_done = 14
 
93
    skipping_socket = 15
89
94
 
90
95
def Info(s, code=InfoCode.generic, extra=None):
91
96
    """Shortcut used for info messages (verbosity 5)."""
119
124
    incomplete_backup = 5
120
125
    orphaned_backup = 6
121
126
    ftp_ncftp_v320 = 7 # moved from error
 
127
    cannot_iterate = 8
 
128
    cannot_stat = 9
 
129
    cannot_read = 10
 
130
    no_sig_for_time = 11
122
131
 
123
 
def Warn(s, code=WarningCode.generic):
 
132
def Warn(s, code=WarningCode.generic, extra=None):
124
133
    """Shortcut used for warning messages (verbosity 2)"""
125
 
    Log(s, WARNING, code)
 
134
    Log(s, WARNING, code, extra)
126
135
 
127
136
class ErrorCode:
128
137
    """Enumeration class to hold error code values.
131
140
       to indicate which error occurred via both exit code and log."""
132
141
    generic = 1 # Don't use if possible, please create a new code and use it
133
142
    command_line = 2
134
 
    source_mismatch = 3
 
143
    hostname_mismatch = 3
135
144
    no_manifests = 4
136
145
    mismatched_manifests = 5
137
146
    unreadable_manifests = 6
167
176
    get_ulimit_failed = 36
168
177
    maxopen_too_low = 37
169
178
    connection_failed = 38
 
179
    restart_file_not_found = 39
 
180
    gio_not_available = 40
 
181
    source_dir_mismatch = 42 # 41 is reserved for par2
170
182
 
171
183
def FatalError(s, code, extra=None):
172
184
    """Write fatal error message and exit"""