(t *testing.T)
| 14 | } |
| 15 | |
| 16 | func TestLogging(t *testing.T) { |
| 17 | t.Parallel() |
| 18 | |
| 19 | // skip |
| 20 | if testing.Short() { |
| 21 | t.Skip() |
| 22 | } |
| 23 | |
| 24 | // set levels (static random) |
| 25 | SetLogLevel(WarningLevel) |
| 26 | SetLogLevel(InfoLevel) |
| 27 | SetLogLevel(ErrorLevel) |
| 28 | SetLogLevel(DebugLevel) |
| 29 | SetLogLevel(CriticalLevel) |
| 30 | SetLogLevel(TraceLevel) |
| 31 | |
| 32 | // log |
| 33 | Trace("Trace") |
| 34 | Debug("Debug") |
| 35 | Info("Info") |
| 36 | Warning("Warning") |
| 37 | Error("Error") |
| 38 | Critical("Critical") |
| 39 | |
| 40 | // logf |
| 41 | Tracef("Trace %s", "f") |
| 42 | Debugf("Debug %s", "f") |
| 43 | Infof("Info %s", "f") |
| 44 | Warningf("Warning %s", "f") |
| 45 | Errorf("Error %s", "f") |
| 46 | Criticalf("Critical %s", "f") |
| 47 | |
| 48 | // play with levels |
| 49 | SetLogLevel(CriticalLevel) |
| 50 | Warning("Warning") |
| 51 | SetLogLevel(TraceLevel) |
| 52 | |
| 53 | // log invalid level |
| 54 | log(0xFF, "msg", nil) |
| 55 | |
| 56 | // wait logs to be written |
| 57 | time.Sleep(1 * time.Millisecond) |
| 58 | |
| 59 | // do not really shut down, we may need logging for other tests |
| 60 | // ShutdownLogging() |
| 61 | } |
nothing calls this directly
no test coverage detected