************************************************************************** Implementation of callback for github.com/couchbase/clog.SetLoggerCallback Our main library that uses clog is cbgt, so all logging goes to KeyDCP. Note that although sg-replicate uses clog's log levels, sgreplicateLogFn b
(level, format string, v ...interface{})
| 137 | // |
| 138 | // ************************************************************************** |
| 139 | func ClogCallback(level, format string, v ...interface{}) string { |
| 140 | switch level { |
| 141 | case "ERRO", "FATA", "CRIT": |
| 142 | logTo(context.TODO(), LevelError, KeyAll, KeyDCP.String()+": "+format, v...) |
| 143 | case "WARN": |
| 144 | // TODO: cbgt currently logs a lot of what we'd consider info as WARN, |
| 145 | // (i.e. diagnostic information that's not actionable by users), so |
| 146 | // routing to Info pending potential enhancements on cbgt side. |
| 147 | logTo(context.TODO(), LevelInfo, KeyDCP, format, v...) |
| 148 | case "INFO": |
| 149 | // TODO: cbgt currently logs a lot of what we'd consider debug as INFO, |
| 150 | // (i.e. janitor work and partition status), so |
| 151 | // routing to Debug pending potential enhancements on cbgt side. |
| 152 | logTo(context.TODO(), LevelDebug, KeyDCP, format, v...) |
| 153 | case "DEBU": |
| 154 | logTo(context.TODO(), LevelDebug, KeyDCP, format, v...) |
| 155 | case "TRAC": |
| 156 | logTo(context.TODO(), LevelTrace, KeyDCP, format, v...) |
| 157 | } |
| 158 | return "" |
| 159 | } |
| 160 | |
| 161 | // ************************************************************** |
| 162 | // Implementation for github.com/couchbase/goutils/logging.Logger |