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

Invalid logging level #147

Open
CorentinB opened this issue Sep 21, 2024 · 0 comments
Open

Invalid logging level #147

CorentinB opened this issue Sep 21, 2024 · 0 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers P2 high priority

Comments

@CorentinB
Copy link
Collaborator

CorentinB commented Sep 21, 2024

I'm seeing a lot of DEBUG logs printed to stdout:

time=2024-09-21T09:25:34.468+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="invalid character 'd' looking for beginning of value" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.485+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="invalid character '$' looking for beginning of value" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.486+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="unexpected end of JSON input" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.486+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="unexpected end of JSON input" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.487+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="unexpected end of JSON input" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.487+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="unexpected end of JSON input" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.487+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="invalid character '\\'' looking for beginning of value" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.497+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="unexpected end of JSON input" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/
time=2024-09-21T09:25:34.501+02:00 level=DEBUG msg="unable to extract URLs from JSON in script tag" error="unexpected end of JSON input" url=https://old.reddit.com/r/PublicFreakout/comments/1fla2ks/another_video_of_israeli_soldiers_throwing/

Even though the code seems to specify the INFO level for stdout.

	customLoggerConfig := log.Config{
		FileConfig: &log.LogfileConfig{
			Dir:    logfileOutputDir,
			Prefix: "zeno",
		},
		FileLevel:                slog.LevelDebug,
		StdoutEnabled:            !config.NoStdoutLogging,
		StdoutLevel:              slog.LevelInfo,
		RotateLogFile:            true,
		RotateElasticSearchIndex: true,
		ElasticsearchConfig: &log.ElasticsearchConfig{
			Addresses:   config.ElasticSearchURLs,
			Username:    config.ElasticSearchUsername,
			Password:    config.ElasticSearchPassword,
			IndexPrefix: config.ElasticSearchIndexPrefix,
			Level:       slog.LevelDebug,
		},
	}
	if len(config.ElasticSearchURLs) == 0 || (config.ElasticSearchUsername == "" && config.ElasticSearchPassword == "") {
		customLoggerConfig.ElasticsearchConfig = nil
	}

	customLogger, err := log.New(customLoggerConfig)
	if err != nil {
		return nil, err
	}
	c.Log = customLogger
@CorentinB CorentinB added bug Something isn't working P2 high priority labels Sep 21, 2024
@CorentinB CorentinB added the good first issue Good for newcomers label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers P2 high priority
Projects
None yet
Development

No branches or pull requests

2 participants