Skip to content

Commit fcacfd8

Browse files
committed
add python 2.6 support via logutils
1 parent 07596c5 commit fcacfd8

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: python
22
python:
3+
- "2.6"
34
- "2.7"
45
# command to install dependencies
56
install:

logging_yamlconfig/configloader.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
import logging.config
66

77

8+
# use 3rd party library for
9+
try:
10+
dictConfig = logging.dictConfig
11+
except AttributeError:
12+
import logutils.dictconfig
13+
dictConfig = logutils.dictconfig.dictConfig
14+
15+
816
class YamlEnvLoader(yaml.Loader):
917
"""
1018
an extended YAML loader which can get values from environment variables where _ENV is specified, e.g.
@@ -109,7 +117,7 @@ def configure_fh(self, fh):
109117

110118
def configure_dict(self, dct):
111119
try:
112-
logging.config.dictConfig(dct)
120+
dictConfig(dct)
113121
except Exception, e:
114122
print >>sys.stderr, "ERROR: could not configure logger with logging yaml- %s" % str(e)
115123

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
PyYAML>=3.11,<3.12
2+
logutils==0.3.3

0 commit comments

Comments
 (0)