Save owncast logs to log file. Closes #908
This commit is contained in:
21
main.go
21
main.go
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/markbates/pkger"
|
||||
"github.com/owncast/owncast/logging"
|
||||
"github.com/sirupsen/logrus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/owncast/owncast/config"
|
||||
@@ -30,7 +29,6 @@ var (
|
||||
)
|
||||
|
||||
func main() {
|
||||
configureLogging()
|
||||
|
||||
// Enable bundling of admin assets
|
||||
_ = pkger.Include("/admin")
|
||||
@@ -57,12 +55,14 @@ func main() {
|
||||
if BuildPlatform != "" {
|
||||
config.BuildPlatform = BuildPlatform
|
||||
}
|
||||
log.Infoln(config.GetReleaseString())
|
||||
|
||||
if *logDirectory != "" {
|
||||
config.LogDirectory = *logDirectory
|
||||
}
|
||||
|
||||
configureLogging(*enableDebugOptions, *enableVerboseLogging)
|
||||
log.Infoln(config.GetReleaseString())
|
||||
|
||||
// Create the data directory if needed
|
||||
if !utils.DoesFileExists("data") {
|
||||
os.Mkdir("./data", 0700)
|
||||
@@ -83,16 +83,6 @@ func main() {
|
||||
log.Exit(0)
|
||||
}
|
||||
|
||||
if *enableDebugOptions {
|
||||
logrus.SetReportCaller(true)
|
||||
}
|
||||
|
||||
if *enableVerboseLogging {
|
||||
log.SetLevel(log.TraceLevel)
|
||||
} else {
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
|
||||
config.EnableDebugFeatures = *enableDebugOptions
|
||||
|
||||
if *dbFile != "" {
|
||||
@@ -144,11 +134,10 @@ func main() {
|
||||
if err := router.Start(); err != nil {
|
||||
log.Fatalln("failed to start/run the router", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func configureLogging() {
|
||||
logging.Setup()
|
||||
func configureLogging(enableDebugFeatures bool, enableVerboseLogging bool) {
|
||||
logging.Setup(enableDebugFeatures, enableVerboseLogging)
|
||||
log.SetFormatter(&log.TextFormatter{
|
||||
FullTimestamp: true,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user