2 Commits

Author SHA1 Message Date
674327e0cf Added a multi-writer so that log messages go to both the console and log file
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-09-03 10:51:25 -04:00
602ddb1a00 Added example config file to the build files
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-09-03 10:46:01 -04:00
3 changed files with 22 additions and 4 deletions

2
.gitignore vendored
View File

@ -16,7 +16,7 @@
*.out *.out
# Dependency directories (remove the comment below to include it) # Dependency directories (remove the comment below to include it)
# vendor/ vendor/
# Go workspace file # Go workspace file
go.work go.work

View File

@ -0,0 +1,15 @@
log_to_file = true
log_file = '~/adept/adept.log'
log_level = 'info'
[transcoder]
repository = '~/adept'
interval = 15
video_format = 'mov'
video_codec = 'dnxhd'
video_profile = 'dnxhr_hq'
video_resolution = '1920x1080'
video_framerate = 60
video_color = 'yuv422p'
audio_codec = 'pcm_s16le'

View File

@ -1,6 +1,7 @@
package config package config
import ( import (
"io"
"log" "log"
"os" "os"
@ -20,10 +21,12 @@ func InitLogging() *os.File {
log.Fatalf("Error opening log file: %v", err) log.Fatalf("Error opening log file: %v", err)
os.Exit(1) os.Exit(1)
} }
// set logging to file handle
log.SetOutput(fileHandle)
} }
// create a MultiWriter instance so we can write to both console AND file
mw := io.MultiWriter(os.Stdout, fileHandle)
// set our multiwriter object as the output for logging
log.SetOutput(mw)
return fileHandle return fileHandle
} }