Fixed problem with logfile
This commit is contained in:
6
main.go
6
main.go
@@ -18,11 +18,11 @@ func main() {
|
|||||||
panic("Can't determine home directory")
|
panic("Can't determine home directory")
|
||||||
}
|
}
|
||||||
appDir := filepath.Join(homeDir, ".local", "share", "mars_terraform_registry")
|
appDir := filepath.Join(homeDir, ".local", "share", "mars_terraform_registry")
|
||||||
logFilePath := filepath.Join(appDir, "logs")
|
logFileDir := filepath.Join(appDir, "logs")
|
||||||
if err := os.MkdirAll(logFilePath, 0755); err != nil {
|
if err := os.MkdirAll(logFileDir, 0755); err != nil {
|
||||||
panic("Can't create log directory")
|
panic("Can't create log directory")
|
||||||
}
|
}
|
||||||
|
logFilePath := filepath.Join(logFileDir, "mars_terraform_registry.log")
|
||||||
// Create Lumberjack rolling logger (replaces *os.File)
|
// Create Lumberjack rolling logger (replaces *os.File)
|
||||||
logFile := &lumberjack.Logger{
|
logFile := &lumberjack.Logger{
|
||||||
Filename: logFilePath,
|
Filename: logFilePath,
|
||||||
|
|||||||
Reference in New Issue
Block a user