-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple config loading & log initialization #471
Conversation
d5e569f
to
f11b7e8
Compare
@@ -425,12 +412,14 @@ func loadConfig() (*vspdConfig, error) { | |||
} | |||
|
|||
// Create new database. | |||
err = database.CreateNew(cfg.dbPath, cfg.FeeXPub, cfg.logger(" DB")) | |||
fmt.Printf("Initializing new database at %s\n", cfg.dbPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now these won't be in the logs.
@@ -165,8 +160,6 @@ func CreateNew(dbFile, feeXPub string, log slog.Logger) error { | |||
return err | |||
} | |||
|
|||
log.Info("Database initialized") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a log you wouldn't want to lose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per #465, creating the database will soon be in a new dedicated binary, so this is somewhat temporary/irrelevant.
This logger did not write any useful information and all errors generated by the func are already returned to the caller for logging.
Loading config and preparing loggers are two separate concepts which should be handled individually. Nesting one inside the other makes little sense and complicates reusing the code.
Loading config and preparing loggers are two separate concepts which should be handled individually. Nesting one inside the other makes little sense and complicates reusing the code.