Skip to content

Commit

Permalink
update props to 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
王铁堂 committed Mar 20, 2019
1 parent 12ef91b commit b9e6f2e
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 252 deletions.
110 changes: 54 additions & 56 deletions app/metrics_collector.go
Original file line number Diff line number Diff line change
@@ -1,74 +1,72 @@
package main

import (
log "github.com/sirupsen/logrus"
"github.com/mattn/go-colorable"
"github.com/tietang/spring-cloud-monitor"
"github.com/tietang/go-utils"
"time"
"net/http"
"net"
"github.com/mattn/go-colorable"
log "github.com/sirupsen/logrus"
"github.com/tietang/spring-cloud-monitor"
"github.com/x-cray/logrus-prefixed-formatter"
"net"
"net/http"
"time"
)

const (
DATE_FORMAT = "2006-01-02.15:04:05.999999"
DATE_FORMAT = "2006-01-02.15:04:05.999999"
)

func init() {

//formatter := &log.TextFormatter{}
//formatter.ForceColors = true
//formatter.DisableColors = false
//formatter.FullTimestamp = true
//formatter.TimestampFormat = "2006-01-02.15:04:05.999999"
//
//formatter := &log.TextFormatter{}
//formatter.ForceColors = true
//formatter.DisableColors = false
//formatter.FullTimestamp = true
//formatter.TimestampFormat = "2006-01-02.15:04:05.999999"
//

//formatter := &prefixed.TextFormatter{}
formatter := &utils.TextFormatter{}
formatter.ForceColors = true
formatter.DisableColors = false
formatter.FullTimestamp = true
formatter.ForceFormatting = true
formatter.EnableLogLine = true
formatter.EnableLogFuncName = true
//formatter.EnableLogFuncName = false
formatter.SetColorScheme(&utils.ColorScheme{
InfoLevelStyle: "green",
WarnLevelStyle: "yellow",
ErrorLevelStyle: "red",
FatalLevelStyle: "red",
PanicLevelStyle: "red",
DebugLevelStyle: "blue",
PrefixStyle: "cyan+b",
TimestampStyle: "black+h",
})
formatter.TimestampFormat = "2006-01-02.15:04:05.000000"
log.SetFormatter(formatter)
log.SetOutput(colorable.NewColorableStdout())
//log.SetOutput(os.Stdout) propfile
//log.SetLevel(log.WarnLevel)
formatter := &prefixed.TextFormatter{}
//formatter := &utils.TextFormatter{}
formatter.ForceColors = true
formatter.DisableColors = false
formatter.FullTimestamp = true
formatter.ForceFormatting = true
//formatter.EnableLogFuncName = false
formatter.SetColorScheme(&prefixed.ColorScheme{
InfoLevelStyle: "green",
WarnLevelStyle: "yellow",
ErrorLevelStyle: "red",
FatalLevelStyle: "red",
PanicLevelStyle: "red",
DebugLevelStyle: "blue",
PrefixStyle: "cyan+b",
TimestampStyle: "black+h",
})
formatter.TimestampFormat = "2006-01-02.15:04:05.000000"
log.SetFormatter(formatter)
log.SetOutput(colorable.NewColorableStdout())
//log.SetOutput(os.Stdout) propfile
//log.SetLevel(log.WarnLevel)

//log.SetOutput(os.Stdout) propfile
log.SetLevel(log.DebugLevel)
//log.SetOutput(os.Stdout) propfile
log.SetLevel(log.DebugLevel)

http.DefaultClient.Transport = &http.Transport{
DialContext: (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 600 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 5,
IdleConnTimeout: 900 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
http.DefaultClient.Timeout = 10 * time.Second
http.DefaultClient.Transport = &http.Transport{
DialContext: (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 600 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 5,
IdleConnTimeout: 900 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
http.DefaultClient.Timeout = 10 * time.Second

}
func main() {
c := collector.NewCollectorByFile("conf.ini")
//c := collector.NewCollectorByFile("/Users/tietang/my/gitcode/r_app/src/github.com/tietang/spring-boot-collector/app/config.ini")
c.Start()
c := collector.NewCollectorByFile("conf.ini")
//c := collector.NewCollectorByFile("/Users/tietang/my/gitcode/r_app/src/github.com/tietang/spring-boot-collector/app/config.ini")
c.Start()

}
Loading

0 comments on commit b9e6f2e

Please sign in to comment.