Skip to content

add support for bunyan style log method: log.info({foo: 'bar'}, 'hi');#2

Open
complyue wants to merge 4 commits intoSagacify:masterfrom
complyue:master
Open

add support for bunyan style log method: log.info({foo: 'bar'}, 'hi');#2
complyue wants to merge 4 commits intoSagacify:masterfrom
complyue:master

Conversation

@complyue
Copy link
Copy Markdown

@complyue complyue commented Aug 1, 2016

I'd like to continue using one of node-bunyan's log method style, but not working correctly in latest python-bunyan:

For
logger.info({'foo': 'bar'}, 'hi');

expected:

{"name": "__main__", "foo": "bar", "msg": "hi", "time": "2016-08-02T03:37:28Z", "hostname": "cymp.local", "level": 30, "pid": 8643, "v": 0}

but msg is empty:

{"name": "__main__", "foo": "bar", "msg": "", "time": "2016-08-02T03:41:38Z", "hostname": "cymp.local", "level": 30, "pid": 10003, "v": 0}

And I updated the code for it to work as expected.

So far nosetests tests passed for 3.5.2/2.7

cymp:python-bunyan cyue$ python -V
Python 3.5.2 :: Anaconda 4.1.1 (x86_64)
cymp:python-bunyan cyue$ nosetests tests 
.......
----------------------------------------------------------------------
Ran 7 tests in 0.004s

OK

cymp:python-bunyan cyue$ python -V
Python 2.7.10
cymp:python-bunyan cyue$ nosetests tests 
.......
----------------------------------------------------------------------
Ran 7 tests in 0.004s

OK

@ghost
Copy link
Copy Markdown

ghost commented Aug 1, 2016

06a5617

ignore PyCharm project settings

Conform status to <type>(<scope>): <subject> pattern
type and scope cannot contain spaces or parenthesis

909592b

reduce runtime exceptions by shimming OrderedDict with dict

Conform status to <type>(<scope>): <subject> pattern
type and scope cannot contain spaces or parenthesis
Shorten status from 59 to 50 characters

634ebcc

add support for bunyan style log method: log.info({foo: 'bar'}, 'hi');

Conform status to <type>(<scope>): <subject> pattern
type and scope cannot contain spaces or parenthesis
Shorten status from 70 to 50 characters

5e41d89

use simplejson to workaround NaN/Infinity

Conform status to <type>(<scope>): <subject> pattern
type and scope cannot contain spaces or parenthesisMore info here

@complyue
Copy link
Copy Markdown
Author

complyue commented Aug 1, 2016

any hint? seems commit messages are constrained by some format, what's the format?

@kfrancoi
Copy link
Copy Markdown

kfrancoi commented Aug 2, 2016

Indeed, we like to standardize our commit message format and use an agent for that at Sagacify. Don't worry about that here though, I will review your commit and merge it if it seems ok.

That being said, if you would like to comply with our commit message structure, the SagaStalin agent shows you the structure in its comments.

Thanks for your contribution

@complyue
Copy link
Copy Markdown
Author

complyue commented Aug 2, 2016

Okay, so I understand Stalin just mandatory <type>(<scope>): part before <subject>, right? If so I don't think I can spell type and scope well enough without close collaboration in your env. That leave my conformance for later consideration.

BTW I'm now struggling to have bunyan log print well in PyCharm, I know you may not be using PyCharm, but I'd like to hear any ideas. Pls have a look at my SO question if you have time: http://stackoverflow.com/questions/38708246/

@aborsu
Copy link
Copy Markdown
Contributor

aborsu commented Aug 4, 2016

Hey, sorry I'm on holiday right now so I won't have time to look at the code until next week. Don't hesitate to ping me if I forget.

Regarding the commit message formatting, all repos in our organisation follow the semantic release commit message formatting. This means one of the following as commit type: fix feat(feature) test doc and I can't remember the rest.
Look up semantic release or sagastalin's report for more info. In Sagacity/komitet-gita-bezopasnosty (sorry no links as I'm on my phone).

Also the name python Bunyan is a bit of a lie. We started from an old package no longer maintained but we are actually copying the behaviour of our other loggers. Sagacity/logger and Sagacify/scala-logger.

That said, I'll have a look at your patch next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants