Files
lndhub.go/lib/logging/filelogging.go
Roman Useinov 628071160c Cleanup (#25)
* remove cmd folder as we are going to have only one entrypoint

* get rid of pkg directory

* rename test -> integration_tests as unit tests should reside next to the actual files they are testing

* database migration WIP

* reinstate gorm boilerplate in the addinvoice for now to make it compile

* introduce migrations

* add Makefile

* don't use unsigned types for database mappings

* migrations work now

* add build target

* use echo groups

* gorm removed

* add envconfig

* fix comments
2022-01-16 00:49:19 +01:00

25 lines
430 B
Go

package logging
import (
"os"
"path/filepath"
"strings"
"time"
)
func GetLoggingFile(path string) (*os.File, error) {
extension := filepath.Ext(path)
if extension != "" {
path = strings.Replace(path, extension, time.Now().Format("2006-01-02 15:04:05")+extension, 1)
} else {
path = path + time.Now().Format("2006-01-02 15:04:05")
}
f, err := os.Create(path)
if err != nil {
return nil, err
}
return f, err
}