Keep It Simple, Stupid | |
PerlMonks |
Re^2: Moose based logging questionby jandrew (Chaplain) |
on Feb 10, 2014 at 17:53 UTC ( [id://1074293]=note: print w/replies, xml ) | Need Help?? |
jellisii2,
My question (and sample code) wasn't intended to be an indictment of Log4perl which is a well written and well thought out program with lots of good community support. I apologize if I did not correctly communicate that earlier. I have included a list below of why I went out on my own designing a new logger but in the end you might be able to chalk it up to a learning experience. For starters tobyink has finally motivated me to learn about and try prototypes, introduced me to the bang bang operator, and pointed me to an intriguing module which is worth the effort all on it's own. This all started with the question; what if a logger was Moose extensible? But has the additional added functions
I wanted a report buffer (default off) for each report name. This allows for some messages to be discarded after they were collected based on branches in the code. A use case for this is when you are recursively parsing some logic but only want to log the actions in the path that yielded results. This is different than a print buffer that always goes to the output but the send is just delayed. I wanted a test module that could capture the logged messages prior to final arrival at the destination report. The idea is to leverage the buffer listed above. The value is to test logged output without having to build a report to capture it first. I wanted a report output that was smart enough to not re-add the headers each time the report was linked. (Only the first time it was built.) I wanted to be able to use method calls and code references when formatting 'Report' output. While my API isn't as mature as Log4perl's 'PatternLayout' it (mostly) supports sprintf formatting. The goal is a Moose based logger. You probably already have an opinion on Moose so no further explanation provided. I like Moose and I currently have no plans to switch to Moo but I would convert to the new p5-MOP I wanted a one stop shop for file outputs. I mentally group file outputs from code into two categories. First is 'log_file' output. This is the way that code leaves tracks from the ongoing process that it follows. Second is 'report' output. This is when data is generated by code for consumption elsewhere. Yes, I know that Log::Dispatch already provides this. General flexibility and ease of definition for configuration through either config. files or data structures. Separation of output creation and destination definitions. Output level screening by name-space and urgency. This includes the possibility of custom level definitions by report name-space.
In Section
Seekers of Perl Wisdom
|
|