Skip to content

Commit

Permalink
Merge 8e237a2 into e670adb
Browse files Browse the repository at this point in the history
  • Loading branch information
gnulnx committed Jan 12, 2019
2 parents e670adb + 8e237a2 commit 705e4ff
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 18 deletions.
45 changes: 33 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,54 @@
# Support for python 3.2 and 3.3 discontinued because django officially dropped support in 1.8
# https://docs.djangoproject.com/en/1.9/releases/1.9/#django-1-9-release-notes
language: python

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7-dev"

env:
# Test out support for lowest/highest pymongo/django combos
- PYMONGO=">=3.0" DJANGO="==1.9.8"
- PYMONGO=">=3.0" DJANGO=">=2.0"
# command to install dependencies
services:
- mongodb
addons:
apt:
sources:
- mongodb-3.4-precise
packages:
- mongodb-org-server

matrix:
- MONGODB=2.6.12
- MONGODB=3.0.15
- MONGODB=3.2.20
- MONGODB=3.4.16
- MONGODB=3.6.6
- MONGODB=4.0.0
- MONGODB=4.1.1
- PYMONGO=">=3.0" DJANGO="==1.9.8"
- PYMONGO=">=3.0" DJANGO=">=2.0"

matrix:
fast_finish: true

install:
- pip install -r requirements.txt
- pip install coveralls
- pip install pymongo$PYMONGO
- pip freeze

- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz
- tar xzf mongodb-linux-x86_64-${MONGODB}.tgz
- ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version
- pip install Pillow
- python setup.py install

before_script:
- mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
- ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork

# command to run tests
script: coverage run --source=mongolog/ manage.py test

after_script:
- pkill mongod

after_success:
- coverage report
- coveralls
- pip freeze

17 changes: 13 additions & 4 deletions mongolog/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,23 @@ def check_keys(self, record):
return record

for k, v in record['msg'].items():
record['msg'][self.new_key(k)] = record['msg'].pop(k)
self._check_keys(k, v, record['msg'])

if isinstance(v, dict):
for old_key in record['msg'][k].keys():
record['msg'][k][self.new_key(old_key)] = record['msg'][k].pop(old_key)
# if isinstance(v, dict):
# for old_key in record['msg'][k].keys():
# record['msg'][k][self.new_key(old_key)] = record['msg'][k].pop(old_key)

return record

def _check_keys(self, k, v, _dict):
_dict[self.new_key(k)] = _dict.pop(k)

if isinstance(v, dict):
for nk, vk in v.items():
self._check_keys(nk, vk, v)
# for in _dict[k].items():
# _dict[k][self.new_key(old_key)] = _dict[k].pop(old_key)

def create_log_record(self, record):
"""
Convert the python LogRecord to a MongoLog Record.
Expand Down
10 changes: 9 additions & 1 deletion mongolog/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@ def test_dot_in_key(self):
self.logger.info({
'META': {
'user.name': 'jfurr',
'user$name': 'jfurr'
'user$name': 'jfurr',
'META2': {
'blah.blah': 'blah',
'blah$blah': 'blah',
'META3': {
'meta3.meta3': 'meta3',
'meta$meta': 'meta3',
}
}
},
'user.name': 'jfurr',
'user$name': 'jfurr'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from setuptools import setup

VERSION = "0.9.2"
VERSION = "0.9.3"

with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
Expand Down

0 comments on commit 705e4ff

Please sign in to comment.