natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.8k stars 591 forks source link

Write a file header on each new file created #50

Closed DnlLrssn closed 7 years ago

DnlLrssn commented 7 years ago

I need a file header to be written each time a new file is created. I don't see a way to do this, especially on rotate. Will add a PR with a suggested solution.

DnlLrssn commented 7 years ago

https://github.com/natefinch/lumberjack/pull/51

natefinch commented 7 years ago

I'm curious what the use case is for this? What do you want to write in the header?

DnlLrssn commented 7 years ago

In my case I want to write in a CSV format for easily reading the log into a analytics tool. For this I need a header for what each column represent. However I figured there might be other reason why you might do this and it could be useful for others.

natefinch commented 7 years ago

That's an interesting use case...

natefinch commented 7 years ago

So, upon thinking about this... I think your specific use case is too specific. The tool you're importing data into should give you the option of setting column names. I don't think this feature is useful in enough cases to merit an API change.

DnlLrssn commented 7 years ago

Had to think and experiment quite a bit, but I have a solution now which will not require the CSV header. Thank you for considering the request.