Changeset 116:7c91042d57cb

Show
Ignore:
Timestamp:
11/08/08 02:41:25 (3 years ago)
Author:
chris
Branch:
unix
Parents:
115:3285597f9cd8 (diff), 114:aba83de344c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

avoid erroring out caused by using the logger when the log config file isn't found.

Files:
1 removed
3 modified

Legend:

Unmodified
Added
Removed
  • Config.py

    r114 r116  
    4949class Config(object): 
    5050        def __init__(self, appname, config_file = None, log_config_file = None): 
    51                 self.log                  = logging.getLogger('Config') 
     51                self.log                  = None 
    5252                self.__appname            = appname 
    5353                self.__config_file        = '' 
     
    6464                        self.log.debug("Using logging configuration file %s" % self.__log_config_file) 
    6565                else: 
    66                         self.log.error("Log configuration file [%s] not found" % self.__log_config_file) 
     66                        print("Log configuration file [%s] not found" % self.__log_config_file) 
    6767                        if(not os.path.exists(self.__config_dir)): 
    6868                                os.mkdir(self.__config_dir) 
    6969                        sys.exit(0) 
     70 
     71                self.log                  = logging.getLogger('Config') 
    7072 
    7173                if(config_file): 
  • Config.py

    r100 r116  
    22 
    33""" 
    4 StormXmlSiren 
    5 Copyright (C) 2008      Chris Freeze <cfreeze/cfreeze_com\> 
     4StormSiren 
     5Copyright (C) 2008  Chris Freeze <cfreeze/cfreeze_com\> 
    66 
    77Redistribution and use in source and binary forms, with or without 
     
    1010 
    11111. Redistributions of source code must retain the above copyright 
    12         notice, this list of conditions and the following disclaimer. 
     12  notice, this list of conditions and the following disclaimer. 
    13132. Redistributions in binary form must reproduce the above copyright 
    14         notice, this list of conditions and the following disclaimer in the 
    15         documentation and/or other materials provided with the distribution. 
     14  notice, this list of conditions and the following disclaimer in the 
     15  documentation and/or other materials provided with the distribution. 
    1616 
    1717THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
     
    2828 
    2929""" 
    30 This is StormXmlSiren a program inspired by the StormSiren application 
    31 written by Roy McManus <slorf/users_sourceforge_net>.   Much like the 
    32 original StormSiren, StormXmlSiren is a simple script capable of scanning 
    33 and providing notifications of weather bulletins issued by the National  
    34 Weather Service.        StormXmlSiren supports a wide range of paging devices 
    35 and filtering of alert types per alert device.  While inspired by  
    36 StormSiren, StormXmlSiren is a complete rewrite that is capable of using 
     30This is StormSiren a program inspired by the StormSiren application 
     31written by Roy McManus <slorf/users_sourceforge_net>.  Much like the 
     32original StormSiren written by Roy McManus <slorf/users_sourceforge_net>, 
     33this program is a simple script capable of scanning and providing 
     34notifications of weather bulletins issued by the National 
     35Weather Service.  StormSiren supports a wide range of paging devices 
     36and filtering of alert types per alert device.  While inspired by 
     37StormSiren, StormSiren is a complete rewrite that is capable of using 
    3738the new CAP/XML feeds provided at http://www.weather.gov/alerts/. 
    3839 
    39 For more information there is a readme.txt located within the docs dir. 
     40For more information there is see the README.TXT file located in the root 
     41of this directory. 
    4042""" 
    4143 
     
    4749class Config(object): 
    4850        def __init__(self, appname, config_file = None, log_config_file = None): 
    49                 self.log                  = logging.getLogger('Config') 
     51                self.log                  = None 
    5052                self.__appname            = appname 
    5153                self.__config_file        = '' 
     
    6062                if(os.path.exists(self.__log_config_file)): 
    6163                        logging.config.fileConfig(self.__log_config_file) 
    62                         self.log.info("Using logging configuration file %s" % self.__log_config_file) 
     64                        self.log.debug("Using logging configuration file %s" % self.__log_config_file) 
    6365                else: 
    64                         self.log.error("Log configuration file [%s] not found" % self.__log_config_file) 
     66                        print("Log configuration file [%s] not found" % self.__log_config_file) 
    6567                        if(not os.path.exists(self.__config_dir)): 
    6668                                os.mkdir(self.__config_dir) 
    6769                        sys.exit(0) 
     70 
     71                self.log                  = logging.getLogger('Config') 
    6872 
    6973                if(config_file): 
     
    7276 
    7377                if(os.path.exists(self.__config_file)): 
    74                         self.log.info("Using configuration file with %s" % self.__config_file) 
     78                        self.log.debug("Using configuration file with %s" % self.__config_file) 
    7579                        self.__configParser.read(self.__config_file) 
    7680                        self._load() 
  • JabberAlertDevice.py

    r108 r116  
    22 
    33""" 
    4 StormSiren 
    5 Copyright (C) 2008  Chris Freeze <cfreeze/cfreeze_com\> 
     4StormXmlSiren 
     5Copyright (C) 2008      Chris Freeze <cfreeze/cfreeze_com\> 
    66 
    77Redistribution and use in source and binary forms, with or without 
     
    1010 
    11111. Redistributions of source code must retain the above copyright 
    12   notice, this list of conditions and the following disclaimer. 
     12        notice, this list of conditions and the following disclaimer. 
    13132. Redistributions in binary form must reproduce the above copyright 
    14   notice, this list of conditions and the following disclaimer in the 
    15   documentation and/or other materials provided with the distribution. 
     14        notice, this list of conditions and the following disclaimer in the 
     15        documentation and/or other materials provided with the distribution. 
    1616 
    1717THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
     
    2828 
    2929""" 
    30 This is StormSiren a program inspired by the StormSiren application 
    31 written by Roy McManus <slorf/users_sourceforge_net>.  Much like the 
    32 original StormSiren written by Roy McManus <slorf/users_sourceforge_net>, 
    33 this program is a simple script capable of scanning and providing 
    34 notifications of weather bulletins issued by the National 
    35 Weather Service.  StormSiren supports a wide range of paging devices 
    36 and filtering of alert types per alert device.  While inspired by 
    37 StormSiren, StormSiren is a complete rewrite that is capable of using 
     30This is StormXmlSiren a program inspired by the StormSiren application 
     31written by Roy McManus <slorf/users_sourceforge_net>.   Much like the 
     32original StormSiren, StormXmlSiren is a simple script capable of scanning 
     33and providing notifications of weather bulletins issued by the National  
     34Weather Service.        StormXmlSiren supports a wide range of paging devices 
     35and filtering of alert types per alert device.  While inspired by  
     36StormSiren, StormXmlSiren is a complete rewrite that is capable of using 
    3837the new CAP/XML feeds provided at http://www.weather.gov/alerts/. 
    3938 
    40 For more information there is see the README.TXT file located in the root 
    41 of this directory. 
     39For more information there is a readme.txt located within the docs dir. 
    4240""" 
    4341 
    44 import xmpp 
    4542import logging 
     43 
     44try: 
     45        import xmpp 
     46except ImportError: 
     47        pass 
     48 
    4649 
    4750from AlertDevice import *