Changeset c4f8b20945a5e435568ec60a1cd51ed432c3f3cd
- Timestamp:
- 04/06/08 23:41:58
(9 months ago)
- Author:
- Jason Michalski <armooo@armooo.net>
- git-committer:
- Jason Michalski <armooo@armooo.net> 1207543318 -0500
- git-parent:
[4d7b8019d2d6426ca4fba0e4fc71f23c061138cf]
- git-author:
- Jason Michalski <armooo@armooo.net> 1207543318 -0500
- Message:
Added more complex setup of logging
See the python logging documation.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rae39ac9 |
rc4f8b20 |
|
| 2 | 2 | |
|---|
| 3 | 3 | import logging |
|---|
| 4 | | logging.basicConfig(level=logging.DEBUG) |
|---|
| 5 | | |
|---|
| | 4 | import logging.config |
|---|
| | 5 | import os |
|---|
| | 6 | import ConfigParser |
|---|
| 6 | 7 | import beacon, httpserver, os, sys |
|---|
| 7 | 8 | import config |
|---|
| 8 | 9 | from plugin import GetPlugin |
|---|
| | 10 | |
|---|
| | 11 | def init_logging(): |
|---|
| | 12 | config.config_files |
|---|
| | 13 | p = os.path.dirname(__file__) |
|---|
| | 14 | |
|---|
| | 15 | if config.config.has_section('loggers') and\ |
|---|
| | 16 | config.config.has_section('handlers') and\ |
|---|
| | 17 | config.config.has_section('formatters'): |
|---|
| | 18 | |
|---|
| | 19 | logging.config.fileConfig(config.config_files) |
|---|
| | 20 | |
|---|
| | 21 | elif config.getDebug(0): |
|---|
| | 22 | logging.basicConfig(level=logging.DEBUG) |
|---|
| | 23 | else: |
|---|
| | 24 | logging.basicConfig(level=logging.INFO) |
|---|
| | 25 | |
|---|
| | 26 | init_logging() |
|---|
| 9 | 27 | |
|---|
| 10 | 28 | port = config.getPort() |
|---|