Re:How to buck a tree: Cutting logs for maximum yield (2018)
by helsontaveras18 on Monday July 11, 2022 @09:40PM
(#32064553)
Haha love it. Question regarding getting the most from your application logs. My practice is to prefix log statements with the file name and function that’s generating the log. Jumping to that code is just a quick search away. But it does require a bit of manual work to write that extra metadata. I do this because devs just put random logs and it’s so hard to know where they’re coming from. Any best practices?
[ Parent
| on HN ]
Re:How to buck a tree: Cutting logs for maximum yield (2018)
by jdadj on Monday July 11, 2022 @09:54PM
(#32064655)
Not sure about best practices. But at our small shop, we’ve rigged up our homegrown logging infrastructure to do that automatically by using the C/C++ macros __FILE__, __FUNCTION__ and __LINE__
We hide the data in our log viewer to reduce clutter but display it as a tooltip.
Re:How to buck a tree: Cutting logs for maximum yield (2018)
by MarkSweep on Monday July 11, 2022 @09:53PM
(#32064647)
Various languages have ways of automatically including file paths and line numbers without the caller having to include them every time
C# has CallerFilePathAttribute https://docs.microsoft.com/en-us/dotnet/api/system.runtime.c...
C has the __FILE__, __func__, and __LINE__ pre-processor macros.