-
Notifications
You must be signed in to change notification settings - Fork 160
resolved #769 and comments are removed #808
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import ( | |
"github.com/meshery/meshkit/broker" | ||
"github.com/meshery/meshkit/logger" | ||
nats "github.com/nats-io/nats.go" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
var ( | ||
|
@@ -98,7 +99,7 @@ func New(opts Options) (broker.Handler, error) { | |
var lerr error | ||
lg, lerr = logger.New("nats-handler", logger.Options{ | ||
Format: logger.TerminalLogFormat, | ||
LogLevel: 4, // Info | ||
LogLevel: int(logrus.InfoLevel), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the other file in this PR, using To improve encapsulation, the |
||
}) | ||
if lerr != nil { | ||
// fallback to nil; we'll use std log where necessary | ||
|
@@ -277,4 +278,4 @@ func (in *Nats) IsEmpty() bool { | |
return true | ||
} | ||
return in.nc == nil && in.wg == nil && in.ctx == nil && in.cancel == nil | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using
logrus.InfoLevel
is a great improvement over the magic number4
, it introduces a direct dependency on thelogrus
package here. This couples thebroker
package to the implementation details of thelogger
package.A better long-term solution would be for the
logger
package to expose its own log level constants (e.g.,logger.InfoLevel
). This would allow consumer packages to depend only on thelogger
abstraction, not its underlyinglogrus
implementation, and would remove the need to importlogrus
in this file.Since changing the
logger
package is likely outside the scope of this PR, the current change is a good step forward. You might consider creating a follow-up technical debt ticket to address this.