mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-01-27 08:49:35 +01:00
* 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
25 lines
430 B
Go
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
|
|
}
|