Start logging to file for debugging

This commit is contained in:
HikariKnight 2023-04-10 13:10:19 +02:00
parent 9204f72e91
commit 7f5a75dd94
4 changed files with 30 additions and 2 deletions

View file

@ -6,6 +6,7 @@ import (
"regexp"
"github.com/HikariKnight/ls-iommu/pkg/errorcheck"
"github.com/HikariKnight/quickpassthrough/internal/logger"
"github.com/HikariKnight/quickpassthrough/pkg/fileio"
"github.com/HikariKnight/quickpassthrough/pkg/uname"
"github.com/klauspost/cpuid/v2"
@ -83,6 +84,9 @@ func InitConfigs() {
// If the path exists
if fileio.FileExist(syspath) {
// Write to log
logger.Printf("%s found on the system\nCreating %s", syspath, confpath)
// Create the directories for our configs
err := os.MkdirAll(confpath, os.ModePerm)
errorcheck.ErrorCheck(err)
@ -103,6 +107,9 @@ func InitConfigs() {
// If the file exists
if fileio.FileExist(sysfile) {
// Write to log
logger.Printf("%s found on the system\nCreating %s", sysfile, conffile)
// Create the directories for our configs
file, err := os.Create(conffile)
errorcheck.ErrorCheck(err)