~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/trace.py

  • Committer: Michael Hudson
  • Date: 2008-09-30 03:05:31 UTC
  • mfrom: (226.1.3 fix-breadcrumbs)
  • Revision ID: michael.hudson@canonical.com-20080930030531-at8220tnkx9pvqcw
small fixes to the breadcrumbs in the --prefix case.
(thanks Matt Nordhoff for the prods)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import logging
25
25
import sys
26
26
 
27
 
 
28
27
def make_handler(config, filename):
29
28
    roll = config.get('log.roll', 'never')
30
29
    if roll == 'daily':
31
 
        h = logging.handlers.TimedRotatingFileHandler(filename,
32
 
                                                      'midnight',
33
 
                                                      1,
34
 
                                                      100)
 
30
        h = logging.handlers.TimedRotatingFileHandler(filename, 'midnight', 1, 100)
35
31
    elif roll == 'weekly':
36
32
        h = logging.handlers.TimedRotatingFileHandler(filename, 'W0', 1, 100)
37
33
    else:
46
42
        os.mkdir(log_folder)
47
43
 
48
44
    f = logging.Formatter('%(levelname)-.3s [%(asctime)s.%(msecs)03d]'
49
 
                          ' %(name)s: %(message)s',
50
 
                          '%Y%m%d-%H:%M:%S')
 
45
                          ' %(name)s: %(message)s','%Y%m%d-%H:%M:%S')
51
46
    debug_log = make_handler(config, os.path.join(log_folder, 'debug.log'))
52
47
    debug_log.setLevel(logging.DEBUG)
53
48
    debug_log.setFormatter(f)
60
55
    access_log = make_handler(config, os.path.join(log_folder, 'access.log'))
61
56
    access_log.setLevel(logging.INFO)
62
57
    access_log.setFormatter(f)
63
 
 
 
58
    
64
59
    error_log = make_handler(config, os.path.join(log_folder, 'error.log'))
65
60
    error_log.setLevel(logging.ERROR)
66
61
    error_log.setFormatter(f)