Package pyjamas :: Module log
[hide private]
[frames] | no frames]

Source Code for Module pyjamas.log

 1  """Use this to output (cumulatively) text at the bottom of the HTML page. 
 2  NOTE: This module is for convenience only and uses pyjamas.logging, a ported 
 3  version of Python's logging module. You can use Pyjamas' logging directly as 
 4  you would with Python, at your option.""" 
 5   
 6  raise DeprecationWarning("""pyjamas.log has been replaced by pyjamas.logging! 
 7    Please replace the import of your logging code as follows: 
 8      from pyjamas import logging 
 9      log = logging.getAppendLogger(__name__, logging.DEBUG, logging.PLAIN_FORMAT) 
10    All occurrences of 'log.write()' and 'log.writebr()' must be replaced by 
11    one of the standard logging functions: 
12      log.debug() 
13      log.info() 
14      log.warning() 
15      log.error() 
16      log.critical() 
17    If you want to continue using pyjamas.log for now remove the raise statement 
18    on top of """ + __file__ + """ 
19   
20    See the Pyjamas FAQ at http://pyjs.org#FAQ for more details on logging.""") 
21   
22  from pyjamas import logging 
23   
24  __logger = logging.getAppendLogger(__name__, 
25                                     logging.DEBUG, 
26                                     logging.PLAIN_FORMAT) 
27   
28 -def setLogger(logger):
29 """ 30 Replace the logger currently in use by a new one, e.g. 31 log.setLogger(logging.getXxxxLogger()) ... Xxxx = Alert, Append, Console 32 """ 33 global __logger 34 __logger = logger
35
36 -def debug(msg, *args, **kwargs):
37 __logger.debug(msg, *args, **kwargs)
38
39 -def info(msg, *args, **kwargs):
40 __logger.info(msg, *args, **kwargs)
41
42 -def warning(msg, *args, **kwargs):
43 __logger.warning(msg, *args, **kwargs)
44 45 warn = warning 46
47 -def error(msg, *args, **kwargs):
48 __logger.error(msg, *args, **kwargs)
49
50 -def critical(msg, *args, **kwargs):
51 __logger.critical(msg, *args, **kwargs)
52 53 fatal = critical 54
55 -def exception(msg, *args):
56 __logger.exception(msg, *args)
57 58
59 -def write(text):
60 """@deprecated: (since='0.8', replacement=logging.debug)""" 61 __logger.debug(text)
62
63 -def writebr(text):
64 """@deprecated: (since='0.8', replacement=logging.debug)""" 65 write(text + "\n")
66