Skip to content

Commit

Permalink
remove default stats logger to prevent error in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
untoldone committed Aug 29, 2017
1 parent 3014d7e commit 360c0c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion api/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ func StatsLogger() *log.Logger {
logStyle := viper.GetString("statsLogger")
switch logStyle {
case "syslog":
statsWriter, _ = syslog.New(syslog.LOG_NOTICE, "bloomapi-stats")
var err error
statsWriter, err = syslog.New(syslog.LOG_NOTICE, "bloomapi-stats")
if err != nil {
log.Fatal("Error sending logs to syslog, check BloomAPI configuration")
}
case "stdout":
statsWriter = os.Stdout
default:
Expand Down
2 changes: 1 addition & 1 deletion config.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ searchHosts = [
]
bloomapiPort = 3005
yourchartUrl = "http://yourchart:3001"
statsLogger = "syslog" # values can be: 'syslog' or 'stdout'
generalLogger = "stdout"
#statsLogger = "syslog" # values can be: 'syslog' or 'stdout', default is nothing
3 changes: 2 additions & 1 deletion middleware/record_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func (s *RecordFeatures) ServeHTTP(rw http.ResponseWriter, r *http.Request, next
features := api.GetFeatures(r)
j, _ := json.Marshal(features)
featureJson := string(j)
api.StatsLogger().Println(featureJson)
stats := api.StatsLogger()
stats.Println(featureJson)
next(rw, r)
}

0 comments on commit 360c0c3

Please sign in to comment.