Windows: fix UTC time logging
This commit is contained in:
parent
094ee1522e
commit
dfcfcee208
5 changed files with 11 additions and 2 deletions
|
@ -31,6 +31,7 @@ Please take a look at the usage below to customize the startup options`,
|
||||||
LogMaxAge: logMaxAge,
|
LogMaxAge: logMaxAge,
|
||||||
LogCompress: logCompress,
|
LogCompress: logCompress,
|
||||||
LogVerbose: logVerbose,
|
LogVerbose: logVerbose,
|
||||||
|
LogUTCTime: logUTCTime,
|
||||||
Shutdown: make(chan bool),
|
Shutdown: make(chan bool),
|
||||||
}
|
}
|
||||||
winService := service.WindowsService{
|
winService := service.WindowsService{
|
||||||
|
@ -87,6 +88,9 @@ func getCustomServeFlags() []string {
|
||||||
if logVerbose != defaultLogVerbose {
|
if logVerbose != defaultLogVerbose {
|
||||||
result = append(result, "--"+logVerboseFlag+"=false")
|
result = append(result, "--"+logVerboseFlag+"=false")
|
||||||
}
|
}
|
||||||
|
if logUTCTime != defaultLogUTCTime {
|
||||||
|
result = append(result, "--"+logUTCTimeFlag+"=true")
|
||||||
|
}
|
||||||
if logCompress != defaultLogCompress {
|
if logCompress != defaultLogCompress {
|
||||||
result = append(result, "--"+logCompressFlag+"=true")
|
result = append(result, "--"+logCompressFlag+"=true")
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ var (
|
||||||
portablePassword string
|
portablePassword string
|
||||||
portableLogFile string
|
portableLogFile string
|
||||||
portableLogVerbose bool
|
portableLogVerbose bool
|
||||||
|
portableLogUTCTime bool
|
||||||
portablePublicKeys []string
|
portablePublicKeys []string
|
||||||
portablePermissions []string
|
portablePermissions []string
|
||||||
portableSSHCommands []string
|
portableSSHCommands []string
|
||||||
|
@ -143,6 +144,7 @@ Please take a look at the usage below to customize the serving parameters`,
|
||||||
LogMaxAge: defaultLogMaxAge,
|
LogMaxAge: defaultLogMaxAge,
|
||||||
LogCompress: defaultLogCompress,
|
LogCompress: defaultLogCompress,
|
||||||
LogVerbose: portableLogVerbose,
|
LogVerbose: portableLogVerbose,
|
||||||
|
LogUTCTime: portableLogUTCTime,
|
||||||
Shutdown: make(chan bool),
|
Shutdown: make(chan bool),
|
||||||
PortableMode: 1,
|
PortableMode: 1,
|
||||||
PortableUser: dataprovider.User{
|
PortableUser: dataprovider.User{
|
||||||
|
@ -251,6 +253,7 @@ value`)
|
||||||
value`)
|
value`)
|
||||||
portableCmd.Flags().StringVarP(&portableLogFile, logFilePathFlag, "l", "", "Leave empty to disable logging")
|
portableCmd.Flags().StringVarP(&portableLogFile, logFilePathFlag, "l", "", "Leave empty to disable logging")
|
||||||
portableCmd.Flags().BoolVarP(&portableLogVerbose, logVerboseFlag, "v", false, "Enable verbose logs")
|
portableCmd.Flags().BoolVarP(&portableLogVerbose, logVerboseFlag, "v", false, "Enable verbose logs")
|
||||||
|
portableCmd.Flags().BoolVar(&portableLogUTCTime, logUTCTimeFlag, false, "Use UTC time for logging")
|
||||||
portableCmd.Flags().StringSliceVarP(&portablePublicKeys, "public-key", "k", []string{}, "")
|
portableCmd.Flags().StringSliceVarP(&portablePublicKeys, "public-key", "k", []string{}, "")
|
||||||
portableCmd.Flags().StringSliceVarP(&portablePermissions, "permissions", "g", []string{"list", "download"},
|
portableCmd.Flags().StringSliceVarP(&portablePermissions, "permissions", "g", []string{"list", "download"},
|
||||||
`User's permissions. "*" means any
|
`User's permissions. "*" means any
|
||||||
|
|
|
@ -29,6 +29,7 @@ var (
|
||||||
LogMaxAge: logMaxAge,
|
LogMaxAge: logMaxAge,
|
||||||
LogCompress: logCompress,
|
LogCompress: logCompress,
|
||||||
LogVerbose: logVerbose,
|
LogVerbose: logVerbose,
|
||||||
|
LogUTCTime: logUTCTime,
|
||||||
Shutdown: make(chan bool),
|
Shutdown: make(chan bool),
|
||||||
}
|
}
|
||||||
winService := service.WindowsService{
|
winService := service.WindowsService{
|
||||||
|
|
|
@ -72,6 +72,7 @@ Flags:
|
||||||
--gcs-storage-class string
|
--gcs-storage-class string
|
||||||
-h, --help help for portable
|
-h, --help help for portable
|
||||||
-l, --log-file-path string Leave empty to disable logging
|
-l, --log-file-path string Leave empty to disable logging
|
||||||
|
--log-utc-time Use UTC time for logging
|
||||||
-v, --log-verbose Enable verbose logs
|
-v, --log-verbose Enable verbose logs
|
||||||
-p, --password string Leave empty to use an auto generated
|
-p, --password string Leave empty to use an auto generated
|
||||||
value
|
value
|
||||||
|
|
|
@ -69,8 +69,8 @@ func (s *Service) initLogger() {
|
||||||
func (s *Service) Start() error {
|
func (s *Service) Start() error {
|
||||||
s.initLogger()
|
s.initLogger()
|
||||||
logger.Info(logSender, "", "starting SFTPGo %v, config dir: %v, config file: %v, log max size: %v log max backups: %v "+
|
logger.Info(logSender, "", "starting SFTPGo %v, config dir: %v, config file: %v, log max size: %v log max backups: %v "+
|
||||||
"log max age: %v log verbose: %v, log compress: %v, load data from: %#v", version.GetAsString(), s.ConfigDir, s.ConfigFile,
|
"log max age: %v log verbose: %v, log compress: %v, log utc time: %v, load data from: %#v", version.GetAsString(), s.ConfigDir, s.ConfigFile,
|
||||||
s.LogMaxSize, s.LogMaxBackups, s.LogMaxAge, s.LogVerbose, s.LogCompress, s.LoadDataFrom)
|
s.LogMaxSize, s.LogMaxBackups, s.LogMaxAge, s.LogVerbose, s.LogCompress, s.LogUTCTime, s.LoadDataFrom)
|
||||||
// in portable mode we don't read configuration from file
|
// in portable mode we don't read configuration from file
|
||||||
if s.PortableMode != 1 {
|
if s.PortableMode != 1 {
|
||||||
err := config.LoadConfig(s.ConfigDir, s.ConfigFile)
|
err := config.LoadConfig(s.ConfigDir, s.ConfigFile)
|
||||||
|
|
Loading…
Reference in a new issue