Debug log in Scala with no performance impact

In languages like C/C++/Objective-C it's common to use preprocessor macros to define logging mechanisms that are not even compiled for released binaries, thus causing no performance hit. Something along the lines of:

#ifdef DEBUG
printf("some event we want to log\n");

Now, I know there's no preprocessor in Scala. So my question is: what is the best way to implement a mechanism to log program activity for debug purposes, while impacting performance the least when it's turned off?


You can use scala.annotation.elidable

An annotation for methods for which invocations might be removed in the generated code.

Behavior is influenced by passing -Xelide-below to scalac. Methods marked elidable will be omitted from generated code if the priority given the annotation is lower than to the command line argument. Examples:

Need Your Help

PriorityQueue \ java

java arrays collections priority-queue

Can't think about a better way printing toString with PQ, natural ordered, than copying the entire collection to another one, and using poll method.

Opening .sln files in Windows Vista

windows visual-studio windows-vista

This one seems to be quite ridiculous but how can I open a VS solution file in Windows Vista double-clicking on it?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.