Create+use logs dir within data dir for logging
This commit is contained in:
parent
8b57ddcfb1
commit
5cdb6c3417
@ -10,7 +10,7 @@ import (
|
|||||||
var DatabaseFilePath = "data/owncast.db"
|
var DatabaseFilePath = "data/owncast.db"
|
||||||
|
|
||||||
// LogDirectory is the path to various log files
|
// LogDirectory is the path to various log files
|
||||||
var LogDirectory = "."
|
var LogDirectory = "./data/logs"
|
||||||
|
|
||||||
// EnableDebugFeatures will print additional data to help in debugging.
|
// EnableDebugFeatures will print additional data to help in debugging.
|
||||||
var EnableDebugFeatures = false
|
var EnableDebugFeatures = false
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||||
|
"github.com/owncast/owncast/utils"
|
||||||
"github.com/rifflock/lfshook"
|
"github.com/rifflock/lfshook"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
logger "github.com/sirupsen/logrus"
|
logger "github.com/sirupsen/logrus"
|
||||||
@ -28,6 +29,11 @@ var _level logrus.Level
|
|||||||
|
|
||||||
// Setup configures our custom logging destinations.
|
// Setup configures our custom logging destinations.
|
||||||
func Setup(enableDebugOptions bool, enableVerboseLogging bool) {
|
func Setup(enableDebugOptions bool, enableVerboseLogging bool) {
|
||||||
|
// Create the logging directory if needed
|
||||||
|
if !utils.DoesFileExists(getLogFilePath()) {
|
||||||
|
os.Mkdir(getLogFilePath(), 0700)
|
||||||
|
}
|
||||||
|
|
||||||
// Write logs to a file
|
// Write logs to a file
|
||||||
path := getLogFilePath()
|
path := getLogFilePath()
|
||||||
writer, _ := rotatelogs.New(
|
writer, _ := rotatelogs.New(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user