meshkit icon indicating copy to clipboard operation
meshkit copied to clipboard

Set custom log level, and added formatting fields

Open nebula-aac opened this issue 1 year ago • 12 comments

Description

This PR adds

  • formatted fields
  • a custom log level to call
  • revised Format to account for Warn and Error

Notes for Reviewers

Signed commits

  • [ ] Yes, I signed my commits.

nebula-aac avatar Aug 05 '23 14:08 nebula-aac

Updating reviewers...

leecalcote avatar Aug 18 '23 19:08 leecalcote

How can i test this changes in my local

suhail34 avatar Aug 19 '23 13:08 suhail34

@suhail34 You can checkout this branch locally and then in meshery/meshery, point your go.mod to your local meshkit using replace. Then you can start Meshery and see the logs. Since there are new functions that are added, you can try replacing current .Info, .Error functions with these new functions to see how the logs come out.

@nebula-aac It would be nicer if could have some unit tests here.

Revolyssup avatar Aug 21 '23 05:08 Revolyssup

@nebula-aac Do you have some screenshot examples of how the error logs will look like running it locally?

Revolyssup avatar Aug 21 '23 05:08 Revolyssup

Hey @Revolyssup I tested this is the ss image

suhail34 avatar Aug 21 '23 14:08 suhail34

I was thinking like if we can do the same as syslogformat and add in setformatter disableTimestamp: true something like this

TerminalLogFormat:
		log.SetFormatter(
&logrus.TextFormatter{
			DisableTimestamp: true
		}
)}

suhail34 avatar Aug 21 '23 14:08 suhail34

@suhail34 Also test it with Meshery server. I hope the logs don't get too big with 5-6 lines per error/warn log.

Revolyssup avatar Aug 21 '23 14:08 Revolyssup

I'll have to make some updates on this PR. I'll provide some screenshots

nebula-aac avatar Aug 21 '23 16:08 nebula-aac

If we want to keep it to the minimum on the logs for mesheryctl, I would like to know so that I'm not formatting the wrong fields.

nebula-aac avatar Aug 21 '23 16:08 nebula-aac

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 05 '23 21:10 stale[bot]

@nebula-aac Any updates ?

MUzairS15 avatar Dec 27 '23 14:12 MUzairS15

I think we could define the init funciton and disable the timestamp so that globally all of the logrus has timestamp disabled

suhail34 avatar Dec 27 '23 14:12 suhail34