Skip to content

Commit 6ddac3d

Browse files
author
Matthew Fisher
committed
Merge pull request #2001 from bacongobbler/logger-fix
fix(logger) small logger fixes
2 parents 2bcc858 + d744657 commit 6ddac3d

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

controller/scheduler/coreos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
MATCH = re.compile(
14-
'(?P<app>[a-z0-9-]+)_?(?P<version>v[0-9]+)?\.?(?P<c_type>[a-z]+)?.(?P<c_num>[0-9]+)')
14+
'(?P<app>[a-z0-9-]+)_?(?P<version>v[0-9]+)?\.?(?P<c_type>[a-z-_]+)?.(?P<c_num>[0-9]+)')
1515

1616

1717
class UHTTPConnection(httplib.HTTPConnection):

logger/syslogd/syslogd.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package main
22

33
import (
4-
"errors"
54
"fmt"
6-
"github.com/deis/deis/logger/syslog"
75
"io"
6+
"log"
87
"os"
98
"os/signal"
109
"path"
1110
"regexp"
1211
"syscall"
12+
13+
"github.com/deis/deis/logger/syslog"
1314
)
1415

1516
const logRoot = "/var/log/deis"
@@ -45,10 +46,10 @@ func fileExists(path string) (bool, error) {
4546
}
4647

4748
func getLogFile(m *syslog.Message) (io.Writer, error) {
48-
r := regexp.MustCompile(`^.* ([-a-z0-9]+)\[[a-z0-9\.]+\].*`)
49+
r := regexp.MustCompile(`^.* ([-a-z0-9]+)\[[a-z0-9-_\.]+\].*`)
4950
match := r.FindStringSubmatch(m.String())
5051
if match == nil {
51-
return nil, errors.New("Could not find app name in message")
52+
return nil, fmt.Errorf("Could not find app name in message: %s", m)
5253
}
5354
appName := match[1]
5455
filePath := path.Join(logRoot, appName+".log")
@@ -84,13 +85,11 @@ func (h *handler) mainLoop() {
8485
if m == nil {
8586
break
8687
}
87-
fmt.Println(m)
8888
err := writeToDisk(m)
8989
if err != nil {
90-
panic(err)
90+
log.Println(err)
9191
}
9292
}
93-
fmt.Println("Exit handler")
9493
h.End()
9594
}
9695

@@ -106,7 +105,6 @@ func main() {
106105
<-sc
107106

108107
// Shutdown the server
109-
fmt.Println("Shutdown the server...")
108+
fmt.Println("Shutting down...")
110109
s.Shutdown()
111-
fmt.Println("Server is down")
112110
}

0 commit comments

Comments
 (0)