Projects STRLCPY tun2socks Commits 22b15f6f
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    log/emitter.go
     1 +package log
     2 + 
     3 +import (
     4 + "io"
     5 + "time"
     6 + 
     7 + glog "gvisor.dev/gvisor/pkg/log"
     8 +)
     9 + 
     10 +func init() {
     11 + EnableStackLog(true)
     12 +}
     13 + 
     14 +func EnableStackLog(v bool) {
     15 + if v {
     16 + glog.SetTarget(&emitter{}) // built-in logger
     17 + } else {
     18 + glog.SetTarget(&glog.Writer{Next: io.Discard})
     19 + }
     20 +}
     21 + 
     22 +type emitter struct{}
     23 + 
     24 +func (e emitter) Emit(_ int, level glog.Level, _ time.Time, format string, args ...any) {
     25 + logf(Level(level)+2, "[STACK] "+format, args...)
     26 +}
     27 + 
Please wait...
Page is in error, reload to recover