Chaining formatters?

32 views
Skip to first unread message

mkloster

unread,
Aug 15, 2012, 5:19:00 PM8/15/12
to cocoalu...@googlegroups.com
Can formatters be chained? That is, can a logger have multiple formatters applied to it? It appears calling [logger setFormatter] replaces the previous formatter.

Use case could be to use a formatter which applies a logging format, and another which functions as a whitelist filter.

thanks,
Michael

Robbie Hanson

unread,
Aug 15, 2012, 11:00:40 PM8/15/12
to cocoalu...@googlegroups.com
I've considered something like this in the past...

When I was first designing lumberjack, and researching other logging frameworks, I noticed things like separation of filters and formatters and chained formatters, etc. Ultimately I decided to "keep it simple".  A formatter is a filter is a formatter. I felt that keeping the architecture conceptually simple (at least at this level) would pay off. My intent is that complexity can be added within the formatter itself. For example, one could craft a "formatter container" which accepts a list of independent formatters, and applies them serially. This allows for advanced techniques such as chaining, headers/footers, etc.

I hope this helps. Let me know your thoughts.

-- 
Robbie Hanson
Sent with Sparrow

--
You received this message because you are subscribed to the Google Groups "CocoaLumberjack" group.
To post to this group, send email to cocoalu...@googlegroups.com.
To unsubscribe from this group, send email to cocoalumberja...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/cocoalumberjack/-/FMM4gV_HeX4J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages