-
Notifications
You must be signed in to change notification settings - Fork 364
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
Replace XRLogger with some logging framework API #76
Comments
G'day @aleksandr-m To support this use case I propose to have a log interceptor for each run configurable in the builder. Then the log output could be shown in the online editor. While doing this I suggest we also move to logging a enum constant (with associated message format) rather than a string directly for anyone that wants to translate or filter log messages. So the log message class might look like following: public class LogMessage {
private final LogMessageId id;
private final Object[] args;
private final Level level;
// constructor...
// getters...
} and the public enum LogMessageId {
UNRECOGNIZED_CSS_PROPERTY("The CSS property {} is not recognized"),
UNIMPLEMENTED_CSS_VALUE("The CSS value {} is not currently implemented");
private final String msgFormat;
private LogMessageId(String format) {
this.msgFormat = format;
}
public String getMessageFormat() {
return msgFormat;
}
} Then we would provide a public class DefaultStringLogInterceptor implements LogReceiver {
private final StringBuilder sb = new StringBuilder();
@Override
public void receive(LogMessage msg) {
sb.append(MessageFormat.format(msg.getId().getMessageFormat(), msg.getArguments()));
}
@Override
public String toString() {
return sb.toString();
}
} As for Log4j2, I would be wary of including it directly as it may cause jar version hell for many users of the library. I agree we should get rid of OK, that's a long post, anyway, what do you think? |
You don't have to include whole Log4j2 just log4j-api. Then the ugly string concatenations
can be replaced with
etc. And the end users can use different logging implementations. |
Add possibility to fetch all logged warning programmatically, see #76
+1 |
@aleksandr-m said:
I fully support this request: it would be highly beneficial (at both implementation and integration levels) to this project to get rid of its legacy logging system in favor of a modern, convenient, widely available framework which neatly integrates to runtime environments without the burden of custom dependencies. |
Log4j2 perhaps? And get rid of
openhtmltopdf-log4j
andopenhtmltopdf-slf4j
.Wdyt?
The text was updated successfully, but these errors were encountered: