A bit more of search and I found klog <https://pkg.go.dev/k8s.io/klog/v2>, 
which conveniently already provides SetLogFilter 
<https://pkg.go.dev/k8s.io/klog/v2#SetLogFilter>, which resolves the issue.

cheers
Jan

ps.: s/logsync/logsink -- sorry.



On Monday, May 22, 2023 at 7:30:11 AM UTC+2 Jan wrote:

> hi,
>
> I want to add a prefix to the glog lines based on certain conditions of my 
> program.
>
> Browsing the glog code I found an example that seems exactly for that in 
> package `glog/internal/logsync`:
>
> https://github.com/golang/glog/blob/master/internal/logsink/logsink.go#L369
>  
>
>  But unfortunately it is marked as `internal`, so not accessible. Any 
> chances it could be made public ?
>
> Or any suggestions on how to easily achieve the same result ?
>
> Thanks!
> Jan
>
> ps.: I looked at other logging libraries, but I do require (use often) 
> fine-grained level control of logging per file, like glog, and the 
> libraries I checked (zap, logrus, zerolog, apex) don't seem to offer that.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/79af619d-219c-4d41-aef2-20e6ef428aa8n%40googlegroups.com.

Reply via email to