google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
7k stars 2.05k forks source link

[proposal] Provide pre-defined JSON log sink in glog #1010

Closed git-hulk closed 8 months ago

git-hulk commented 8 months ago

It's pervasive for the user to process their logs in a structural way(including myself), and I know we can work around this via the customize log link but it's inconvenient for users if they're using glog across many projects.

So I'm wondering if providing the pre-defined JSON log sink in glog is possible? if yes, I'll be happy to submit a PR to resolve this. WDYT? @sergiud

relate issues:

sergiud commented 8 months ago

Thanks for the suggestion. However, such as sink would have only very limited use since projects rely on different structure for representing the logs. With this in mind, it is almost impossible to satisfy all the needs. I'm therefore reluctant adding such use case specific sinks. This also would probably pull an additional dependency or at least a custom JSON writer which feels disproportionate.

and I know we can work around this via the customize log link but it's inconvenient for users if they're using glog across many projects.

I understand what you are saying. However, this is a build system issue not one that should be solved by upstreaming the changes.

Despite these concerns, I'm open for updating the documentation with a corresponding sink example.

git-hulk commented 8 months ago

@sergiud sure, thank you!