actindi / act-fluent-logger-rails

Fluent logger
MIT License
118 stars 72 forks source link

add new messages_type: hash #42

Closed redtear1115 closed 4 years ago

redtear1115 commented 6 years ago

make Exception more readable for elk stack

Rails.logger.info(e)

before

PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint ...    
{controller: 'my', action: 'show', ...}

after

{controller: 'my', action: 'show', custom_message: 'PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint ...', ...}
ryosuke-endo commented 6 years ago

@redtear1115

thank you pull request!

This is my opinion of this pull request.

It is a matter of preference to output logs with json only when it is hash.

If you do, I think it would be better to call it with a plugin.

I do not believe it is to force all users.

redtear1115 commented 6 years ago

Oh! I forgot to mention that it's optional.

In config/fluent-logger.yml, use

messages_type: 'hash'

for the this feature