Skip to content
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

fix: log formatting (initial state) #59

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mrmagicpotato007
Copy link

@mrmagicpotato007 mrmagicpotato007 commented Jan 11, 2025

Description: We identified an issue where the state format is being logged incorrectly at the start of the application. To address this, we are updating the format to align with the logstate function's expected output. This change ensures consistency and improves log readability.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Scenario A
    tested with empty state
    {"type":"STATE","state":null}
  • Scenario B
    tested with state config
    {"type":"STATE","state":{"type":"STREAM"}}

Screenshots or Recordings

Issues Link: #49,
#58

@hash-data hash-data changed the title fix/logstateformat fix: log formatting (initial state) Jan 13, 2025
@hash-data
Copy link
Collaborator

@mrmagicpotato007 can you add issue link in PR, as well as good description for it.

@hash-data hash-data linked an issue Jan 16, 2025 that may be closed by this pull request
@mrmagicpotato007
Copy link
Author

Issue Link: #49
Description: We identified an issue where the state format is being logged incorrectly at the start of the application. To address this, we are updating the format to align with the logstate function's expected output. This change ensures consistency and improves log readability.

protocol/sync.go Outdated Show resolved Hide resolved
@hash-data
Copy link
Collaborator

Issue Link: #49 Description: We identified an issue where the state format is being logged incorrectly at the start of the application. To address this, we are updating the format to align with the logstate function's expected output. This change ensures consistency and improves log readability.

you can edit the PR description and add it there. @mrmagicpotato007

Copy link
Collaborator

@hash-data hash-data left a comment

Choose a reason for hiding this comment

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

will test it

@mrmagicpotato007
Copy link
Author

will test it

Hi @hash-data is this tested ? can we merge?

Comment on lines +56 to +57
logger.Info("Running sync with state: ")
logger.LogState(state)
Copy link
Collaborator

@hash-data hash-data Jan 22, 2025

Choose a reason for hiding this comment

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

it still not look good while printing
can we do something like :

Suggested change
logger.Info("Running sync with state: ")
logger.LogState(state)
stateBytes, _ := state.MarshalJSON()
logger.Infof("Running sync with state: %s", stateBytes)

for this you have to change state unmarshaler as well.

as that is not marking HoldsValue to true for each streams.

Copy link
Collaborator

Choose a reason for hiding this comment

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

it will print something like this

{"type":"LOG","log":{"level":"info","message":"Running sync with state: {\"type\":\"STREAM\",\"streams\":[{\"stream\":\"incr1\",\"namespace\":\"incr\",\"sync_mode\":\"\",\"state\":{\"_data\":\"82678109C1000000022B0429296E1404\"}}]}"}}

Copy link
Author

Choose a reason for hiding this comment

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

sure will make the changes accordingly

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.

state formatting
3 participants