Commit 1771ab03 by bergquist

Merge branch 'master' into alerting

parents 8ec311ad 8b2f6fff
......@@ -14,7 +14,7 @@ install:
- npm install
- npm install -g grunt-cli
# install gcc (needed for sqlite3)
- choco install -y mingw -limitoutput
- choco install -y --limit-output mingw
- set PATH=C:\tools\mingw64\bin;%PATH%
- echo %PATH%
- echo %GOPATH%
......
......@@ -180,17 +180,7 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) {
loggersToClose = append(loggersToClose, fileHandler)
handler = fileHandler
case "syslog":
sysLogHandler := NewSyslog()
sysLogHandler.Format = format
sysLogHandler.Network = sec.Key("network").MustString("")
sysLogHandler.Address = sec.Key("address").MustString("")
sysLogHandler.Facility = sec.Key("facility").MustString("local7")
sysLogHandler.Tag = sec.Key("tag").MustString("")
if err := sysLogHandler.Init(); err != nil {
Root.Error("Failed to init syslog log handler", "error", err)
os.Exit(1)
}
sysLogHandler := NewSyslog(sec, format)
loggersToClose = append(loggersToClose, sysLogHandler)
handler = sysLogHandler
......
......@@ -5,8 +5,10 @@ package log
import (
"errors"
"log/syslog"
"os"
"github.com/inconshreveable/log15"
"gopkg.in/ini.v1"
)
type SysLogHandler struct {
......@@ -18,10 +20,23 @@ type SysLogHandler struct {
Format log15.Format
}
func NewSyslog() *SysLogHandler {
return &SysLogHandler{
func NewSyslog(sec *ini.Section, format log15.Format) *SysLogHandler {
handler := &SysLogHandler{
Format: log15.LogfmtFormat(),
}
handler.Format = format
handler.Network = sec.Key("network").MustString("")
handler.Address = sec.Key("address").MustString("")
handler.Facility = sec.Key("facility").MustString("local7")
handler.Tag = sec.Key("tag").MustString("")
if err := handler.Init(); err != nil {
Root.Error("Failed to init syslog log handler", "error", err)
os.Exit(1)
}
return handler
}
func (sw *SysLogHandler) Init() error {
......
......@@ -2,19 +2,21 @@
package log
import "github.com/inconshreveable/log15"
import (
"github.com/inconshreveable/log15"
"gopkg.in/ini.v1"
)
type SysLogHandler struct {
}
func NewSyslog() *SysLogHandler {
func NewSyslog(sec *ini.Section, format log15.Format) *SysLogHandler {
return &SysLogHandler{}
}
func (sw *SysLogHandler) Init() error {
func (sw *SysLogHandler) Log(r *log15.Record) error {
return nil
}
func (sw *SysLogHandler) Log(r *log15.Record) error {
return nil
func (sw *SysLogHandler) Close() {
}
......@@ -41,12 +41,12 @@ func TestPluginDashboards(t *testing.T) {
Convey("should include installed version info", func() {
So(dashboards[0].Title, ShouldEqual, "Nginx Connections")
So(dashboards[0].Revision, ShouldEqual, "1.5")
So(dashboards[0].InstalledRevision, ShouldEqual, "1.1")
So(dashboards[0].InstalledUri, ShouldEqual, "db/nginx-connections")
//So(dashboards[0].Revision, ShouldEqual, "1.5")
//So(dashboards[0].InstalledRevision, ShouldEqual, "1.1")
//So(dashboards[0].InstalledUri, ShouldEqual, "db/nginx-connections")
So(dashboards[1].Revision, ShouldEqual, "2.0")
So(dashboards[1].InstalledRevision, ShouldEqual, "")
//So(dashboards[1].Revision, ShouldEqual, "2.0")
//So(dashboards[1].InstalledRevision, ShouldEqual, "")
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment