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

SNMP SessionTrace has non-exported dependencies, thus I can't supply my own logging hooks #37

Open
k1eran opened this issue May 26, 2020 · 0 comments
Assignees

Comments

@k1eran
Copy link

k1eran commented May 26, 2020

I want to do this ...

factory.NewSession(
 ctx, 
 address,
 snmp.Community(host.User), 
 snmp.LoggingHooks(MyLoggingHooks))

but quoting https://github.com/damianoneill/net/blob/master/v2/snmp/trace.go :

// SessionTrace defines a structure for handling trace events
type SessionTrace struct {
	// ConnectStart is called before establishing a network connection to an agent.
	ConnectStart func(config *sessionConfig)
	// ConnectDone is called when the network connection attempt completes, with err indicating
	// whether it was successful.
	ConnectDone func(config *sessionConfig, err error)

etc etc

A work around is to use one of the supplied ones i.e. DiagnosticLoggingHooks, DefaultLoggingHooks or NoOpLoggingHooks (though as I want simply timings, the DiagnosticLoggingHooks one very verbose)

@sjames-iberis sjames-iberis self-assigned this May 26, 2020
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

No branches or pull requests

2 participants