github.com/dkerwin/nomad@v0.3.3-0.20160525181927-74554135514b/client/driver/logging/syslog_parser_unix_test.go (about) 1 // +build darwin dragonfly freebsd linux netbsd openbsd solaris 2 3 package logging 4 5 import ( 6 "log" 7 "log/syslog" 8 "os" 9 "testing" 10 ) 11 12 func TestLogParser_Priority(t *testing.T) { 13 line := []byte("<30>2016-02-10T10:16:43-08:00 d-thinkpad docker/e2a1e3ebd3a3[22950]: 1:C 10 Feb 18:16:43.391 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf") 14 d := NewDockerLogParser(log.New(os.Stdout, "", log.LstdFlags)) 15 p, _, err := d.parsePriority(line) 16 if err != nil { 17 t.Fatalf("got an err: %v", err) 18 } 19 if p.Severity != syslog.LOG_INFO { 20 t.Fatalf("expected serverity: %v, got: %v", syslog.LOG_INFO, p.Severity) 21 } 22 23 idx := d.logContentIndex(line) 24 expected := 68 25 if idx != expected { 26 t.Fatalf("expected idx: %v, got: %v", expected, idx) 27 } 28 }