-
Notifications
You must be signed in to change notification settings - Fork 9
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/log lazy and exceptions #106
base: main
Are you sure you want to change the base?
Conversation
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.
Not many comments on this one 😃.
|
||
@Override | ||
public void println(Object x) { | ||
switch (urgency) { |
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.
I am missing the default
case for this switch statement.
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.
Nice catch. I guess an exception should be thrown like colorize
. However, I think it can be dangerous to allow logging to throw exceptions so maybe logging exceptions should just use "Error" as default and colorize
should not use any color?
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.
I would still throw an exception, as reaching the default case is clearly a developer error, as the developer tries to do something with the Log
class that it does not support. An end-user should not reach this point in the code.
Allows for lazy evaluation of the object to log. To enable this a
Supplier
is used on eachUrgency
. Also someSystem.err.println
was used and one print of theException
stacktrace. Because of thisLog
now supports the printing of theException
stacktrace with theLogPrintStream
. For now the default method of printing exceptions uses theUrgency.Error
but allows an overloaded method to have a customUrgency
.