Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 35a8ca2

Browse files
authored
Merge pull request #94 from tommilligan/py38
Update examples and tests for Python 3.8 compatibility
2 parents b3dbb51 + 3f4e3ad commit 35a8ca2

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ python:
55
- "3.5"
66
- "3.6"
77
- "3.7"
8+
- "3.8"
89
install: pip install tox-travis
910
script: tox

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ formatter = CustomJsonFormatter('one;two')
6060

6161
# is equivalent to:
6262

63-
formatter = jsonlogger.JsonFormatter('(one) (two)')
63+
formatter = jsonlogger.JsonFormatter('%(one)s %(two)s')
6464
```
6565

6666
You can also add extra fields to your json output by specifying a dict in place of message, as well as by specifying an `extra={}` argument.
@@ -82,7 +82,7 @@ class CustomJsonFormatter(jsonlogger.JsonFormatter):
8282
else:
8383
log_record['level'] = record.levelname
8484

85-
formatter = CustomJsonFormatter('(timestamp) (level) (name) (message)')
85+
formatter = CustomJsonFormatter('%(timestamp)s %(level)s %(name)s %(message)s')
8686
```
8787

8888
Items added to the log record will be included in *every* log message, no matter what the format requires.

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'Programming Language :: Python :: 3.5',
2626
'Programming Language :: Python :: 3.6',
2727
'Programming Language :: Python :: 3.7',
28+
'Programming Language :: Python :: 3.8',
2829
'Topic :: System :: Logging',
2930
]
3031
)

tests/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def testFormatKeys(self):
6363
'threadName'
6464
]
6565

66-
log_format = lambda x: ['%({0:s})'.format(i) for i in x]
66+
log_format = lambda x: ['%({0:s})s'.format(i) for i in x]
6767
custom_format = ' '.join(log_format(supported_keys))
6868

6969
fr = jsonlogger.JsonFormatter(custom_format)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py34, py35, py36, py37
2+
envlist = py34, py35, py36, py37, py38
33

44
[testenv]
55
commands = python -m unittest discover

0 commit comments

Comments
 (0)