/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2008-08-10 16:13:23 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080810161323-wrh1rbpdrq0otuhf
* mandos (console): Define handler globally.
  (main): If in debug mode, also reduce consol log level.  Remove
          console log handler before daemonizing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
                        ('Mandos: %(levelname)s: %(message)s'))
72
72
logger.addHandler(syslogger)
73
73
 
 
74
console = logging.StreamHandler()
 
75
console.setFormatter(logging.Formatter('%(name)s: %(levelname)s:'
 
76
                                       ' %(message)s'))
 
77
logger.addHandler(console)
74
78
 
75
79
class AvahiError(Exception):
76
80
    def __init__(self, value):
717
721
    
718
722
    if not debug:
719
723
        syslogger.setLevel(logging.WARNING)
 
724
        console.setLevel(logging.WARNING)
720
725
    
721
726
    if server_settings["servicename"] != "Mandos":
722
727
        syslogger.setFormatter(logging.Formatter\
751
756
            avahi.DBUS_INTERFACE_SERVER )
752
757
    # End of Avahi example code
753
758
    
754
 
    if debug:
755
 
        console = logging.StreamHandler()
756
 
        # console.setLevel(logging.DEBUG)
757
 
        console.setFormatter(logging.Formatter\
758
 
                             ('%(levelname)s: %(message)s'))
759
 
        logger.addHandler(console)
760
 
        del console
761
 
    
762
759
    clients = Set()
763
760
    def remove_from_clients(client):
764
761
        clients.remove(client)
776
773
        sys.exit(1)
777
774
    
778
775
    if not debug:
 
776
        logger.removeHandler(console)
779
777
        daemon()
780
778
    
781
779
    pidfilename = "/var/run/mandos/mandos.pid"