Skip to content

Add configuration and logging improvements#23

Closed
Copilot wants to merge 1 commit intofix/#21from
copilot/sub-pr-22
Closed

Add configuration and logging improvements#23
Copilot wants to merge 1 commit intofix/#21from
copilot/sub-pr-22

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

This PR improves configuration flexibility and logging initialization to support environment-based configuration and more robust log level handling.

Changes

  • Configuration: Added environment variable support with viper.SetEnvPrefix("of") and viper.AutomaticEnv() for 12-factor app compliance

  • Logging:

    • Extracted InitLogger() as a separate function callable after viper initialization
    • Support both string ("debug", "info") and integer log levels
    • Support both loglevel and log_level config keys for flexibility
    • Default to InfoLevel when unspecified
  • Error handling: Replaced panic() with structured error logging + os.Exit(1) in P2P node initialization

  • Log noise: Reduced connection summary from Info to Debug level

Example

# Now supports environment variables
export OF_LOGLEVEL=debug
export OF_WALLET_ACCOUNT=abc123
./ocf start

Dependencies

  • Updated stretchr/testify to v1.11.1
  • Added indirect dependencies: go-co-op/gocron/v2, jonboulle/clockwork, robfig/cron/v3

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Feb 12, 2026
Copilot AI changed the title [WIP] Fix issue #21 by addressing the reported problem Add configuration and logging improvements Feb 12, 2026
Copilot AI requested a review from xzyaoi February 12, 2026 10:05
@xzyaoi xzyaoi closed this Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants