(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestWithField(t *testing.T) { |
| 98 | SetLevel(DebugLevel) |
| 99 | if GetLevel() != DebugLevel { |
| 100 | t.Fail() |
| 101 | } |
| 102 | |
| 103 | call0() |
| 104 | |
| 105 | WithError(errors.New("new")).WithField("newfieldkey", "newfieldvalue").WithTime(time.Now()).Debug("debug") |
| 106 | f := new(Fields) |
| 107 | WithError(errors.New("new")).WithFields(*f).WithTime(time.Now()).Debug("debug") |
| 108 | |
| 109 | WithFields(*f).Debug("debug") |
| 110 | WithTime(time.Now()).WithError(errors.New("new")).Debug("debug") |
| 111 | entry := NewEntry(StandardLogger()) |
| 112 | entry.WithTime(time.Now()).String() |
| 113 | entry.Printf("entry printf %d", 1) |
| 114 | |
| 115 | WithField("k", "v").Debug("debug") |
| 116 | WithField("k", "v").Debugln("Debugln") |
| 117 | WithField("k", "v").Debugf("debugf %d", 1) |
| 118 | WithField("k", "v").Print("Print") |
| 119 | WithField("k", "v").Println("Println") |
| 120 | WithField("k", "v").Printf("Printf %d", 1) |
| 121 | WithField("k", "v").Info("info") |
| 122 | WithField("k", "v").Infoln("Infoln") |
| 123 | WithField("k", "v").Infof("infof %d", 1) |
| 124 | WithField("k", "v").Warning("warning") |
| 125 | WithField("k", "v").Warningln("Warningln") |
| 126 | WithField("k", "v").Warningf("Warningf %d", 1) |
| 127 | WithField("k", "v").Warn("warn") |
| 128 | WithField("k", "v").Warnln("Warnln") |
| 129 | WithField("k", "v").Warnln("Warnln") |
| 130 | WithField("k", "v").Warnf("warnf %d", 1) |
| 131 | WithField("k", "v").Error("error") |
| 132 | WithField("k", "v").Errorln("Errorln") |
| 133 | WithField("k", "v").Errorf("errorf %d", 1) |
| 134 | defer func() { |
| 135 | if r := recover(); r != nil { |
| 136 | fmt.Println("Recovered in f", r) |
| 137 | } |
| 138 | defer func() { |
| 139 | if r := recover(); r != nil { |
| 140 | fmt.Println("Recovered in f", r) |
| 141 | } |
| 142 | defer func() { |
| 143 | if r := recover(); r != nil { |
| 144 | fmt.Println("Recovered in f", r) |
| 145 | } |
| 146 | n := NilFormatter{} |
| 147 | a, b := n.Format(&logrus.Entry{}) |
| 148 | if a != nil || b != nil { |
| 149 | t.Fail() |
| 150 | } |
| 151 | }() |
| 152 | WithField("k", "v").Panicf("panicf %d", 1) |
| 153 | }() |
| 154 | WithField("k", "v").Panicln("Panicln") |
nothing calls this directly
no test coverage detected