This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java assert for logging?  RSS feed

 
Mani Venkatesan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have this:

I call a logging API from within an assert expression like so:
assert(log("My message")) ;

where the logging API is
boolean log(String message);

Now I can disable logging (by disabling assert) and also selectively enable/disable logging for certain classes by using the assert functionality.

Do you see any problem with this? If there is none, I would like to this method instead of using a "heavy" logging framework.

Thanks
Mani
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!