glog icon indicating copy to clipboard operation
glog copied to clipboard

Include verbosity in calls to custom LogSinks

Open meidlinga opened this issue 7 years ago • 3 comments

Currently calls to VLOG(n) map to LOG(INFO).

I would like to map the verbosity in my custom log sink. So that the impementing class would be aware if LOG(INFO), or VLOG(n) was used and which number n was.

One way would be to add the verbosity as argument to LogSink::send, and LogSink::toString.

static std::string ToString(LogSeverity severity, const char* file, int line,
                              const struct ::tm* tm_time,
                              const char* message, size_t message_len);

would become

static std::string ToString(LogSeverity severity, int verbosity, const char* file, int line,
                              const struct ::tm* tm_time,
                              const char* message, size_t message_len);

LogSink::send would change accordingly.

Since this would break an existing interface, it could be implement as overload. Please tell me your opionion. If its ok, I would create a PR.

meidlinga avatar Aug 30 '18 16:08 meidlinga

I also would love to be able to have verbosity levels to be reflected in the long sink.

bitonic avatar Jul 27 '19 11:07 bitonic

@sergiud Does this mean that this feature won't be implemented, or was it implemented in some commit not linked here? Thanks.

bitonic avatar Mar 31 '21 08:03 bitonic

I closed the issue due to inactivity.

sergiud avatar Mar 31 '21 08:03 sergiud