Skip to content
Snippets Groups Projects
Commit 187f6d9f authored by Erick Hitter's avatar Erick Hitter
Browse files

Fix logger setup

parent 07da54de
No related branches found
No related tags found
1 merge request!5Add go.mod
...@@ -30,8 +30,7 @@ type tokenSource struct { ...@@ -30,8 +30,7 @@ type tokenSource struct {
var ( var (
configPath string configPath string
logger *log.Logger logger *log.Logger
logDest string
apiKey string apiKey string
threshold int threshold int
...@@ -64,8 +63,7 @@ func initConfig() { ...@@ -64,8 +63,7 @@ func initConfig() {
threshold = cfg.Threshold threshold = cfg.Threshold
deleteStale = cfg.DeleteStale deleteStale = cfg.DeleteStale
logDest = cfg.LogDest setUpLogger(cfg.LogDest)
setUpLogger()
logger.Printf("Starting GitLab Runner monitoring with config %s", configPath) logger.Printf("Starting GitLab Runner monitoring with config %s", configPath)
...@@ -194,7 +192,7 @@ func deleteDroplet(droplet godo.Droplet) bool { ...@@ -194,7 +192,7 @@ func deleteDroplet(droplet godo.Droplet) bool {
return err == nil return err == nil
} }
func setUpLogger() { func setUpLogger(logDest string) {
logOpts := log.Ldate | log.Ltime | log.LUTC | log.Lshortfile logOpts := log.Ldate | log.Ltime | log.LUTC | log.Lshortfile
if logDest == "os.Stdout" { if logDest == "os.Stdout" {
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
) )
func TestCheckDropletAge(t *testing.T) { func TestCheckDropletAge(t *testing.T) {
setUpLogger() setUpLogger("os.stdOut")
staleDroplet := godo.Droplet{ staleDroplet := godo.Droplet{
ID: 1234, ID: 1234,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment