diff --git a/cmd/mount.go b/cmd/mount.go index 3c417e11..b4c02ed7 100644 --- a/cmd/mount.go +++ b/cmd/mount.go @@ -238,6 +238,8 @@ var mountCmd = &cobra.Command{ FlagErrorHandling: cobra.ExitOnError, RunE: func(_ *cobra.Command, args []string) error { options.MountPath = common.ExpandPath(args[0]) + common.MountPath = options.MountPath + configFileExists := true if options.ConfigFile == "" { diff --git a/common/log/base_logger.go b/common/log/base_logger.go index 40893550..023a370b 100644 --- a/common/log/base_logger.go +++ b/common/log/base_logger.go @@ -219,10 +219,11 @@ func (l *BaseLogger) logEvent(lvl string, format string, args ...interface{}) { // Only log if the log level matches the log request _, fn, ln, _ := runtime.Caller(3) msg := fmt.Sprintf(format, args...) - msg = fmt.Sprintf("%s : %s[%d] : %s [%s (%d)]: %s", + msg = fmt.Sprintf("%s : %s[%d] : [%s] %s [%s (%d)]: %s", time.Now().Format(time.UnixDate), l.fileConfig.LogTag, l.procPID, + common.MountPath, lvl, filepath.Base(fn), ln, msg) diff --git a/common/log/sys_logger.go b/common/log/sys_logger.go index 35608952..b982e828 100644 --- a/common/log/sys_logger.go +++ b/common/log/sys_logger.go @@ -120,7 +120,7 @@ func getSyslogLevel(lvl common.LogLevel) syslog.Priority { func (l *SysLogger) write(lvl string, format string, args ...interface{}) { _, fn, ln, _ := runtime.Caller(3) msg := fmt.Sprintf(format, args...) - l.logger.Print(lvl, " [", filepath.Base(fn), " (", ln, ")]: ", msg) + l.logger.Print("[", common.MountPath, "] ", lvl, " [", filepath.Base(fn), " (", ln, ")]: ", msg) } func (l *SysLogger) Debug(format string, args ...interface{}) { diff --git a/common/types.go b/common/types.go index 5933efee..f3520bf7 100644 --- a/common/types.go +++ b/common/types.go @@ -91,6 +91,8 @@ var BfsDisabled = false var TransferPipe = "/tmp/transferPipe" var PollingPipe = "/tmp/pollPipe" +var MountPath string + // LogLevel enum type LogLevel int