Changeset 116:7c91042d57cb
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r114
|
r116
|
|
| 49 | 49 | class Config(object): |
| 50 | 50 | def __init__(self, appname, config_file = None, log_config_file = None): |
| 51 | | self.log = logging.getLogger('Config') |
| | 51 | self.log = None |
| 52 | 52 | self.__appname = appname |
| 53 | 53 | self.__config_file = '' |
| … |
… |
|
| 64 | 64 | self.log.debug("Using logging configuration file %s" % self.__log_config_file) |
| 65 | 65 | 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) |
| 67 | 67 | if(not os.path.exists(self.__config_dir)): |
| 68 | 68 | os.mkdir(self.__config_dir) |
| 69 | 69 | sys.exit(0) |
| | 70 | |
| | 71 | self.log = logging.getLogger('Config') |
| 70 | 72 | |
| 71 | 73 | if(config_file): |
-
|
r100
|
r116
|
|
| 2 | 2 | |
| 3 | 3 | """ |
| 4 | | StormXmlSiren |
| 5 | | Copyright (C) 2008 Chris Freeze <cfreeze/cfreeze_com\> |
| | 4 | StormSiren |
| | 5 | Copyright (C) 2008 Chris Freeze <cfreeze/cfreeze_com\> |
| 6 | 6 | |
| 7 | 7 | Redistribution and use in source and binary forms, with or without |
| … |
… |
|
| 10 | 10 | |
| 11 | 11 | 1. 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. |
| 13 | 13 | 2. 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. |
| 16 | 16 | |
| 17 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| … |
… |
|
| 28 | 28 | |
| 29 | 29 | """ |
| 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 |
| | 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 |
| 37 | 38 | the new CAP/XML feeds provided at http://www.weather.gov/alerts/. |
| 38 | 39 | |
| 39 | | For more information there is a readme.txt located within the docs dir. |
| | 40 | For more information there is see the README.TXT file located in the root |
| | 41 | of this directory. |
| 40 | 42 | """ |
| 41 | 43 | |
| … |
… |
|
| 47 | 49 | class Config(object): |
| 48 | 50 | def __init__(self, appname, config_file = None, log_config_file = None): |
| 49 | | self.log = logging.getLogger('Config') |
| | 51 | self.log = None |
| 50 | 52 | self.__appname = appname |
| 51 | 53 | self.__config_file = '' |
| … |
… |
|
| 60 | 62 | if(os.path.exists(self.__log_config_file)): |
| 61 | 63 | 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) |
| 63 | 65 | 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) |
| 65 | 67 | if(not os.path.exists(self.__config_dir)): |
| 66 | 68 | os.mkdir(self.__config_dir) |
| 67 | 69 | sys.exit(0) |
| | 70 | |
| | 71 | self.log = logging.getLogger('Config') |
| 68 | 72 | |
| 69 | 73 | if(config_file): |
| … |
… |
|
| 72 | 76 | |
| 73 | 77 | 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) |
| 75 | 79 | self.__configParser.read(self.__config_file) |
| 76 | 80 | self._load() |
-
|
r108
|
r116
|
|
| 2 | 2 | |
| 3 | 3 | """ |
| 4 | | StormSiren |
| 5 | | Copyright (C) 2008 Chris Freeze <cfreeze/cfreeze_com\> |
| | 4 | StormXmlSiren |
| | 5 | Copyright (C) 2008 Chris Freeze <cfreeze/cfreeze_com\> |
| 6 | 6 | |
| 7 | 7 | Redistribution and use in source and binary forms, with or without |
| … |
… |
|
| 10 | 10 | |
| 11 | 11 | 1. 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. |
| 13 | 13 | 2. 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. |
| 16 | 16 | |
| 17 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| … |
… |
|
| 28 | 28 | |
| 29 | 29 | """ |
| 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 |
| | 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 |
| 38 | 37 | the new CAP/XML feeds provided at http://www.weather.gov/alerts/. |
| 39 | 38 | |
| 40 | | For more information there is see the README.TXT file located in the root |
| 41 | | of this directory. |
| | 39 | For more information there is a readme.txt located within the docs dir. |
| 42 | 40 | """ |
| 43 | 41 | |
| 44 | | import xmpp |
| 45 | 42 | import logging |
| | 43 | |
| | 44 | try: |
| | 45 | import xmpp |
| | 46 | except ImportError: |
| | 47 | pass |
| | 48 | |
| 46 | 49 | |
| 47 | 50 | from AlertDevice import * |