Pārlūkot izejas kodu

Add timestamps to logs

Alois Mahdal 2 gadus atpakaļ
vecāks
revīzija
f85becba99
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6
    2
      bin/notifirc

+ 6
- 2
bin/notifirc Parādīt failu

@@ -86,9 +86,11 @@ log_pipe() {
86 86
     # Log contents of standard input
87 87
     #
88 88
     local line      # each line of input
89
+    local stamp
89 90
     while IFS= read -r line;
90 91
     do
91
-        log "$line"
92
+    stamp=$(date -Isec)
93
+        log "$stamp $line"
92 94
     done
93 95
 }
94 96
 
@@ -96,7 +98,9 @@ log() {
96 98
     #
97 99
     # Log message $1 to $logfile
98 100
     #
99
-    echo "$1" >>"$logfile"
101
+    local stamp
102
+    stamp=$(date -Isec)
103
+    echo "$stamp | $1" >>"$logfile"
100 104
 }
101 105
 
102 106
 load_defaults() {