Code Review
/
src
/
xds
/
xds-agent.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Standardized XDS config file name and location.
[src/xds/xds-agent.git]
/
lib
/
agent
/
agent.go
diff --git
a/lib/agent/agent.go
b/lib/agent/agent.go
index
d1a3d05
..
a562e77
100644
(file)
--- a/
lib/agent/agent.go
+++ b/
lib/agent/agent.go
@@
-41,6
+41,7
@@
type Context struct {
Config *xdsconfig.Config
Log *logrus.Logger
LogLevelSilly bool
Config *xdsconfig.Config
Log *logrus.Logger
LogLevelSilly bool
+ LogSillyf func(format string, args ...interface{})
SThg *st.SyncThing
SThgCmd *exec.Cmd
SThgInotCmd *exec.Cmd
SThg *st.SyncThing
SThgCmd *exec.Cmd
SThgInotCmd *exec.Cmd
@@
-71,13
+72,21
@@
func NewAgent(cliCtx *cli.Context) *Context {
}
log.Formatter = &logrus.TextFormatter{}
}
log.Formatter = &logrus.TextFormatter{}
+ // Support silly logging (printed on log.debug)
sillyVal, sillyLog := os.LookupEnv("XDS_LOG_SILLY")
sillyVal, sillyLog := os.LookupEnv("XDS_LOG_SILLY")
+ logSilly := sillyLog && sillyVal == "1"
+ sillyFunc := func(format string, args ...interface{}) {
+ if logSilly {
+ log.Debugf("SILLY: "+format, args...)
+ }
+ }
// Define default configuration
ctx := Context{
ProgName: cliCtx.App.Name,
Log: log,
// Define default configuration
ctx := Context{
ProgName: cliCtx.App.Name,
Log: log,
- LogLevelSilly: (sillyLog && sillyVal == "1"),
+ LogLevelSilly: logSilly,
+ LogSillyf: sillyFunc,
Exit: make(chan os.Signal, 1),
webServer: nil,
Exit: make(chan os.Signal, 1),
webServer: nil,
@@
-123,7
+132,7
@@
func (ctx *Context) Run() (int, error) {
ctx._logPrint("Logging file for HTTP requests: %s\n", logFileHTTPReq)
}
ctx._logPrint("Logging file for HTTP requests: %s\n", logFileHTTPReq)
}
- // Create syncthing instance when section "syncthing" is present in config.json
+ // Create syncthing instance when section "syncthing" is present in
agent-
config.json
if ctx.Config.FileConf.SThgConf != nil {
ctx.SThg = st.NewSyncThing(ctx.Config, ctx.Log)
}
if ctx.Config.FileConf.SThgConf != nil {
ctx.SThg = st.NewSyncThing(ctx.Config, ctx.Log)
}