File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
33import (
44 "bytes"
55 "flag"
6+ "fmt"
67 "io"
78 "io/ioutil"
89 "log/syslog"
@@ -17,6 +18,8 @@ import (
1718 "github.com/aws/aws-sdk-go/service/cloudwatchlogs"
1819)
1920
21+ var version string
22+
2023const defaultConfigFile = "/etc/awslogs.conf"
2124
2225type writerHook struct {
@@ -60,14 +63,23 @@ func pickHook(out logoutput) log.Hook {
6063 }
6164}
6265
63- func main () {
66+ func init () {
6467 debug ()
65- log . SetFormatter ( & programFormat {})
66- log . SetOutput ( os . Stderr )
67- log . SetLevel ( log . ErrorLevel )
68+ }
69+
70+ func main () {
6871 var cfgfile string
72+ var print_version bool
6973 flag .StringVar (& cfgfile , "c" , defaultConfigFile , "Config file location." )
74+ flag .BoolVar (& print_version , "v" , false , "Print version and exit." )
7075 flag .Parse ()
76+ if print_version {
77+ fmt .Println (version )
78+ os .Exit (0 )
79+ }
80+ log .SetFormatter (& programFormat {})
81+ log .SetOutput (os .Stderr )
82+ log .SetLevel (log .ErrorLevel )
7183 config := getConfig (cfgfile )
7284 settings := getMainConfig (config )
7385 flows := getFlows (config )
You can’t perform that action at this time.
0 commit comments