Skip to content

Replace fmt.Print with structured logging in ticker.go #114

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amitkaushik2710
Copy link

Changes Made

  • Replaced fmt.Print statements with structured logging (log).
  • Ensured that logs use appropriate log levels (Debug instead of Print).
  • Removed redundant type specifications in map literals.
  • Fixed struct initialization by using keyed fields (models.Time{Time: ...}).

Why This Change?

  • Improves logging consistency.
  • Adheres to best practices for Go logging.
  • Fixes Go lint warnings (e.g., "struct literal uses unkeyed fields" and "redundant type from array, slice, or map composite literal").

References

Copy link
Member

@ranjanrak ranjanrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. As a minor suggestion, since you're already updating the appropriate log levels, you might also want to add context to the errors. For example, in SetMode, you could add context like:
return fmt.Errorf("failed to set mode: %w", err)

You could apply the same approach in Subscribe and other similar locations.

ModeFull: []uint32{},
ModeQuote: []uint32{},
ModeLTP: []uint32{},
ModeFull: {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For safer map handling, let's initialize maps with make(). You can use :

modes := map[Mode][]uint32{
    ModeFull:  make([]uint32, 0),
    ModeQuote: make([]uint32, 0),
    ModeLTP:   make([]uint32, 0),
}

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.

None yet

2 participants