An event bus framework for event driven programming
github.com
github.com
logger.info("...");
versus: EventHandle eh = EBus.getHandle(
eventBuilder.executing().name("some operation").build());
if (eh.isAllowed()) {
eh.addParam("p1","v1").addParam("p2","v2").post();
}
That's a lot of typing.It needs a more compact API.
[1]https://mollyrocket.com/casey/stream_0029.html [2]https://www.nuget.org/packages/Microsoft.Diagnostics.Tracing...
There are more established event buses in Android with simpler syntax, like greenrobot's: EventBus.getInstance().post(new LogEvent("v1", "v2"));
Seen here: http://greenrobot.org/eventbus/documentation/how-to-get-star...
You can have multiple event buses and other customization there as needed, but you have sensible defaults to keep code small most of the time too.
Square also has one called Otto. If you want a lot of syntax and Java rather than Android, you might as well go full streaming with the RxJava library.
if(logger.isDebugEnabled()){
logger.debug("...");
}
And yeah, it requires a bit more typting if you want to enforce a certain event format and want to add more parameters. But you only do that once, and I'd say you gain much more for your effort. logger.debug("...");
and ignore the conditional. If `!logger.isDebugEnabled` then the logger will ignore the message, so it avoids boilerplate. logger.debug(generateSomethingLarge()); logger.debug("My logger message has placeholders {}, {}, {}", some, objects, toLog);
which avoids the issue.But you knew that, because it was you who submitted it.