Package paramiko :: Module logging22
[frames] | no frames]

Source Code for Module paramiko.logging22

 1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
 2  # 
 3  # This file is part of paramiko. 
 4  # 
 5  # Paramiko is free software; you can redistribute it and/or modify it under the 
 6  # terms of the GNU Lesser General Public License as published by the Free 
 7  # Software Foundation; either version 2.1 of the License, or (at your option) 
 8  # any later version. 
 9  # 
10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
13  # details. 
14  # 
15  # You should have received a copy of the GNU Lesser General Public License 
16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
18   
19  """ 
20  Stub out logging on python < 2.3. 
21  """ 
22   
23   
24  DEBUG = 10 
25  INFO = 20 
26  WARNING = 30 
27  ERROR = 40 
28  CRITICAL = 50 
29   
30   
31 -def getLogger(name):
32 return _logger
33 34
35 -class logger (object):
36 - def __init__(self):
37 self.handlers = [ ] 38 self.level = ERROR
39
40 - def setLevel(self, level):
41 self.level = level
42
43 - def addHandler(self, h):
44 self.handlers.append(h)
45
46 - def addFilter(self, filter):
47 pass
48
49 - def log(self, level, text):
50 if level >= self.level: 51 for h in self.handlers: 52 h.f.write(text + '\n') 53 h.f.flush()
54
55 -class StreamHandler (object):
56 - def __init__(self, f):
57 self.f = f
58
59 - def setFormatter(self, f):
60 pass
61
62 -class Formatter (object):
63 - def __init__(self, x, y):
64 pass
65 66 _logger = logger() 67