aboutsummaryrefslogtreecommitdiff
path: root/logger.nim
diff options
context:
space:
mode:
Diffstat (limited to 'logger.nim')
-rw-r--r--logger.nim17
1 files changed, 15 insertions, 2 deletions
diff --git a/logger.nim b/logger.nim
index a4d90a0..48aedf2 100644
--- a/logger.nim
+++ b/logger.nim
@@ -40,9 +40,22 @@ proc puts(f: File, s: string) =
40proc puts(f: File, r: Rune) = 40proc puts(f: File, r: Rune) =
41 f.puts r.toUTF8 41 f.puts r.toUTF8
42 42
43proc loop*(probe: (timeout: Duration) -> int, getSymbol: (int) -> Rune) = 43func formatTimestampDateTime*(dt: DateTime): string =
44 dt.format(TIMESTAMP_FORMAT)
45
46func formatTimestampUnix*(dt: DateTime): string =
47 ($dt.toTime.toUnix) & " "
48
49func formatTimestampNone*(dt: DateTime): string =
50 ""
51
52proc loop*(
53 probe: (timeout: Duration) -> int,
54 getSymbol: (int) -> Rune,
55 timestampHeader: (DateTime) -> string,
56) =
44 while true: 57 while true:
45 stdout.puts now().format(TIMESTAMP_FORMAT) 58 stdout.puts timestampHeader(now())
46 59
47 for tick in 0..<60: 60 for tick in 0..<60:
48 let t = now() 61 let t = now()