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

Added/updated features #2

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

eoghanlawless
Copy link
Collaborator

Added: custom prefix functionality, set a custom prefix to logs
Added: SetOutput functionality, add optional io.Writer output
Updated: SetLogLevel parameters, accepts int/Level type

cianperill and others added 3 commits October 26, 2022 14:42
* SetLogLevel now takes integer arguments as well, README and tests updated appropiately

* Adjusted SetLogLevel functionality
SetLogLevel now only takes Level types as input
Level types now use int instead of uint8
Added StringToLevel and IntToLevel for simpler conversions between primitives and Levels
Changed tests and readme appropiately

* Removed IntToLevel
- IntToLevel was essentially equivalent to Level(int) so it was removed.
- added validateLogLevel to eliminate repeated code

* Removed unnecessary SetLogLevel call

* Added more test cases
- Added some SetLogLevel tests that take Level inputs
- Removed StringToLevel call in SetLogLevel testing to eliminate error logging during testing
- Added some StringToLevel tests to capture and test these errors

* Updated readme with Level table
Also moved StringToLevel test cases to be before their use in SetLogLevel test cases

* Explicitly set each log level constant to its int value

* Updated changes to constant

* Fix spec name after changes

Co-authored-by: Eoghan Russell <[email protected]>

Co-authored-by: John Rey Juele <[email protected]>
Co-authored-by: Eoghan Russell <[email protected]>
* Add SetOutput functionality

This patch adds functionality to set output. When used any subseqent
calls to SetLogOptions or SetLogFile will discard set output. Also
previously set setting are discarded when we call SetOutput.

* Update README.md
)

* Added functionality to update the logging prefix

* Implemented code review suggestions

* Added SetOutput to Table of Contents
return fmt.Sprintf(p.prefixFormat, time.Now().Format(p.timeFormat), loggingLevel)
}

func SetPrefixer(p Prefixer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also have a "SetDefaultPrefixer()" function to set the default prefix in case we want to get back to default ?

@Eoghan1232
Copy link
Collaborator

merging now.
a follow up PR can be done to add "SetDefaultPrefixer()" function

@Eoghan1232 Eoghan1232 merged commit 3eb4480 into k8snetworkplumbingwg:main Jan 17, 2023
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.

6 participants