File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212
1313MATCH = 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
1717class UHTTPConnection (httplib .HTTPConnection ):
Original file line number Diff line number Diff line change 11package main
22
33import (
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
1516const logRoot = "/var/log/deis"
@@ -45,10 +46,10 @@ func fileExists(path string) (bool, error) {
4546}
4647
4748func 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}
You can’t perform that action at this time.
0 commit comments