1
# Copyright 2002 Ben Escoto
3
# This file is part of duplicity.
5
# duplicity is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA
8
# 02139, USA; either version 2 of the License, or (at your option) any
9
# later version; incorporated herein by reference.
11
"""Log various messages depending on verbosity level"""
18
def Log(s, verb_level):
19
"""Write s to stderr if verbosity level low enough"""
20
if verb_level <= termverbosity:
21
if verb_level <= 2: sys.stderr.write(s + "\n")
22
else: sys.stdout.write(s + "\n")
25
"""Shortcut used for warning messages (verbosity 2)"""
29
"""Write fatal error message and exit"""
30
sys.stderr.write(s + "\n")
33
def setverbosity(verb, termverb = None):
34
"""Set the verbosity level"""
35
global verbosity, termverbosity
37
if termverb: termverbosity = termverb
38
else: termverbosity = verb