aboutsummaryrefslogtreecommitdiff
path: root/progname.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-07-29 10:08:43 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-07-29 10:08:43 +0200
commit90b08ea3ee65c5255d623f76b02e66745b7c6335 (patch)
tree5e6428b4c5d087decc13f53befeba8196dc5b21a /progname.go
parent188dab3533159f01347265eb2f32baaf05d1cab7 (diff)
progname and log prefix
Diffstat (limited to 'progname.go')
-rw-r--r--progname.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/progname.go b/progname.go
new file mode 100644
index 0000000..5f14ac5
--- /dev/null
+++ b/progname.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "log"
+ "os"
+ "path"
+)
+
+func init() {
+ log.SetFlags(0)
+ log.SetPrefix(progName() + ": ")
+}
+
+func progName() string {
+ return path.Base(os.Args[0])
+}