Browse Source

Add timestamps to logs

Alois Mahdal 2 years ago
parent
commit
f85becba99
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      bin/notifirc

+ 6
- 2
bin/notifirc View File

86
     # Log contents of standard input
86
     # Log contents of standard input
87
     #
87
     #
88
     local line      # each line of input
88
     local line      # each line of input
89
+    local stamp
89
     while IFS= read -r line;
90
     while IFS= read -r line;
90
     do
91
     do
91
-        log "$line"
92
+    stamp=$(date -Isec)
93
+        log "$stamp $line"
92
     done
94
     done
93
 }
95
 }
94
 
96
 
96
     #
98
     #
97
     # Log message $1 to $logfile
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
 load_defaults() {
106
 load_defaults() {