Skip to content

add support for global logger level and error levels#114

Merged
pawelsz-rb merged 3 commits into
masterfrom
pawel/support_log_levels
May 1, 2025
Merged

add support for global logger level and error levels#114
pawelsz-rb merged 3 commits into
masterfrom
pawel/support_log_levels

Conversation

@pawelsz-rb

@pawelsz-rb pawelsz-rb commented Apr 16, 2025

Copy link
Copy Markdown
Collaborator

Description of the change

  1. Adding support for setting logger level globally
  2. Allowing for error filters based on the error type and its corresponding level

example:

rollbar.SetErrorLevelFilters(
		map[reflect.Type]string{
			reflect.TypeOf(rollbar.ErrBufferFull{}): rollbar.DEBUG,
			reflect.TypeOf(errors.New("")):          rollbar.ERR,
		},
	)  // setting ErrBufferFull to debug level and regular err type to error level
rollbar.SetLoggerLevel(rollbar.IGNORE) // sets global log level to ignore (meaning ignoring all errors and messages) 

the logic first checks for the global log level and then checks for the individual error levels. In the example above, rollbar.SetErrorLevelFilters does not have any affect because rollbar.SetLoggerLevel sets the logger level to IGNORE - it will skip all the messages

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

@pawelsz-rb pawelsz-rb requested review from brianr and waltjones April 16, 2025 05:49
Comment thread base_transport.go Outdated
@pawelsz-rb pawelsz-rb merged commit 545025c into master May 1, 2025
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.

2 participants