TODO pick one of the memory backends and stick with it or share interface. InitForTesting is a convenient method when using logging in a test. Once called, the time will be frozen to January 1, 1970 UTC.
(level Level)
| 18 | // InitForTesting is a convenient method when using logging in a test. Once |
| 19 | // called, the time will be frozen to January 1, 1970 UTC. |
| 20 | func InitForTesting(level Level) *MemoryBackend { |
| 21 | Reset() |
| 22 | |
| 23 | memoryBackend := NewMemoryBackend(10240) |
| 24 | |
| 25 | leveledBackend := AddModuleLevel(memoryBackend) |
| 26 | leveledBackend.SetLevel(level, "") |
| 27 | SetBackend(leveledBackend) |
| 28 | |
| 29 | timeNow = func() time.Time { |
| 30 | return time.Unix(0, 0).UTC() |
| 31 | } |
| 32 | return memoryBackend |
| 33 | } |
| 34 | |
| 35 | // Node is a record node pointing to an optional next node. |
| 36 | type node struct { |