Last active
September 11, 2015 18:57
-
-
Save apokalyptik/a208f32552a5a54cff5b to your computer and use it in GitHub Desktop.
Stupid simple program to add timestampt to a programs output...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"io" | |
"log" | |
"os" | |
) | |
func main() { | |
log.SetOutput(os.Stdout) | |
log.SetFlags(log.Ldate | log.Lmicroseconds) | |
stdin := bufio.NewReader(os.Stdin) | |
for { | |
if line, err := stdin.ReadString('\n'); err == nil { | |
log.Print(line) | |
} else { | |
if line != "" { | |
log.Print(line) | |
} | |
if err != io.EOF { | |
log.Fatal(err) | |
} | |
return | |
} | |
} | |
} |
Author
apokalyptik
commented
Sep 10, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment