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

TT-181 init test logger #8640

Merged
merged 5 commits into from
Mar 9, 2023
Merged

TT-181 init test logger #8640

merged 5 commits into from
Mar 9, 2023

Conversation

gheorghestrimtu
Copy link
Contributor

@gheorghestrimtu gheorghestrimtu commented Mar 7, 2023

Added this to actions

func GetTestLogger(t *testing.T) zerolog.Logger {
	lvlStr := os.Getenv(envConf.EnvVarLogLevel)
	if lvlStr == "" {
		lvlStr = "info"
	}
	lvl, err := zerolog.ParseLevel(lvlStr)
	require.NoError(t, err, "error parsing log level")
	l := zerolog.New(zerolog.NewTestWriter(t)).Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(lvl).With().Timestamp().Logger()
	return l
}

@gheorghestrimtu gheorghestrimtu requested review from a team as code owners March 7, 2023 13:04
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2023

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

skudasov
skudasov previously approved these changes Mar 7, 2023
@@ -336,3 +339,15 @@ func EncodeOnChainExternalJobID(jobID uuid.UUID) [32]byte {
copy(ji[:], strings.Replace(jobID.String(), "-", "", 4))
return ji
}

// GetTestLogger instantiates a logger that takes into account the test context and the log level
func GetTestLogger(t *testing.T) zerolog.Logger {
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually think this might make more sense to add to the chainlink-env environment or config modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skudasov what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Imo we can just have logger.go in each repo.

@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate failed

Failed condition 3.8% 3.85% Duplicated Lines (%) on New Code (is greater than 3%)

See analysis details on SonarQube

@skudasov skudasov requested review from skudasov and tateexon March 9, 2023 12:29
@skudasov skudasov merged commit 8646fcc into develop Mar 9, 2023
@skudasov skudasov deleted the TT-181-init-logger branch March 9, 2023 12:48
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.

3 participants