logging, config file managment, writing library dir

This commit is contained in:
2025-03-22 16:33:04 -05:00
parent 26c02b27ff
commit e3f47c602f
7 changed files with 201 additions and 98 deletions
+34
View File
@@ -0,0 +1,34 @@
package library
import (
"context"
"fmt"
"yellowjacket/backend/logging"
"github.com/wailsapp/wails/v2/pkg/runtime"
)
type Config struct {
DirectoryPath string
}
var DefaultConfig *Config = &Config{
DirectoryPath: "",
}
type Library struct {
ctx context.Context
Conf *Config
}
func GetNewLibrary(ctx context.Context, conf *Config) (*Library, error) {
if conf == nil {
runtime.LogInfo(ctx, fmt.Sprintf("library config is nil, using default config: %s", logging.PrettyJSON(DefaultConfig)))
conf = DefaultConfig
}
runtime.LogInfo(ctx, fmt.Sprintf("creating new library with config: %#v", conf))
return &Library{
ctx: ctx,
Conf: conf,
}, nil
}