_examples/integrations/logrus/print/multi/main.go
raw| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "os" |
| 6 | "time" |
| 7 | |
| 8 | "github.com/kataras/pio" |
| 9 | _ "github.com/kataras/pio/_examples/integrations/logrus" |
| 10 | ) |
| 11 | |
| 12 | func main() { |
| 13 | var ( |
| 14 | delay = 2 * time.Second |
| 15 | times = 5 |
| 16 | ) |
| 17 | |
| 18 | pio.Get("logrus").AddOutput(os.Stdout) |
| 19 | |
| 20 | i := 1 |
| 21 | for range time.Tick(delay) { |
| 22 | pio.Print(fmt.Sprintf("[%d] Printing %d\n", i, time.Now().Second())) |
| 23 | if i == times { |
| 24 | break |
| 25 | } |
| 26 | i++ |
| 27 | |
| 28 | } |
| 29 | <-time.After(1 * time.Second) |
| 30 | } |