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

feat(NSQ): configurable log levels #35

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

Conversation

zakame
Copy link

@zakame zakame commented Oct 15, 2024

Hi, first off, thanks for this good software!

I was trying out an adaptation of the example and couldn't help but notice the log messages being emitted, cf:

2024/10/16 00:20:42 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) connecting to nsqd
2024/10/16 00:20:42 INF    1 (nsqd.xxx.xxx:4150) connecting to nsqd
[...]
2024/10/16 00:22:33 INF    2 [crazy/go] stopping...
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) received CLOSE_WAIT from nsqd
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) beginning close
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) readLoop exiting
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) breaking out of writeLoop
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) writeLoop exiting
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) finished draining, cleanup exiting
2024/10/16 00:22:33 INF    2 [crazy/go] (nsqd.xxx.xxx:4150) clean close complete
2024/10/16 00:22:33 WRN    2 [crazy/go] there are 0 connections left alive
2024/10/16 00:22:33 INF    2 [crazy/go] stopping handlers
2024/10/16 00:22:33 INF    2 [crazy/go] rdyLoop exiting
2024/10/16 00:22:33 INF    1 (nsqd.xxx.xxx:4150) stopping
2024/10/16 00:22:33 INF    1 (nsqd.xxx.xxx:4150) exiting router
2024/10/16 00:22:33 INF    1 (nsqd.xxx.xxx:4150) beginning close
2024/10/16 00:22:33 INF    1 (nsqd.xxx.xxx:4150) readLoop exiting
2024/10/16 00:22:33 INF    1 (nsqd.xxx.xxx:4150) breaking out of writeLoop
2024/10/16 00:22:33 INF    1 (nsqd.xxx.xxx:4150) writeLoop exiting

I looked around to try toggling them off in the current code, but found that this is actually emitted by the underlying nsq driver, which does not expose a control back to the queue.

This PR adds a WithLogLevel Option that takes nsq.LogLevel consts corresponding to the defined log levels, so one can pass it with nsq.LogLevelError all the way to nsq.LogLevelDebug for increasing levels of verbosity. Not sure if this is the way to do it, so would appreciate guidance 🙇 Thanks!

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.

1 participant