Closed shimotori closed 11 years ago
This gem output all log messages in one request as one fluentd event. I think that when I write
config.log_tags = [:uuid, :remote_ip]
in application.rb,
2013-03-18T14:40:15+09:00 outing {"messages":["Started GET \"/assets/sakidori_02.jpg\" for 127.0.0.1 at 2013-03-18 14:40:15 +0900","Served asset /sakidori_02.jpg - 304 Not Modified (14ms)"],"level":"INFO","uuid":"5d2341c559cfaa3348447a06f847c9e4","remote_ip":"127.0.0.1"}
is better than
2013-03-18T14:40:15+09:00 outing {"messages":["[5d2341c559cfaa3348447a06f847c9e4] [127.0.0.1] Started GET \"/assets/sakidori_02.jpg\" for 127.0.0.1 at 2013-03-18 14:40:15 +0900","[5d2341c559cfaa3348447a06f847c9e4] [127.0.0.1] Served asset /sakidori_02.jpg - 304 Not Modified (14ms)"],"level":"INFO"}
What do you think?
That's great. I like your idea.
Please reject my PR and implement it.
I release 0.1.1.
config.logger = ActFluentLoggerRails::Logger.
new(log_tags: {
ip: :ip,
ua: :user_agent,
uid: ->(request) { request.session[:uid] }
})
Don't use config.log_tags.
You can add any tags at run time.
logger[:foo] = "foo value"
Thanks.
I found that the tags of
config.log_tags
didn't appear when using this gem. With this fix, they are written asActiveSupport::TaggedLogging
does.