Setting a global "if (!verbose) then (ignore all printlns)"
Is there any way that I can set up some kind of global system such that only if my 'verbose' flag is true will any System.out.printlns get excecuted? If verbose is not true, then these should all be ignored. Is that possible?
That is, I'd prefer not to have to type out every time
System.out.println("Initializing main testing engine");Any recommendations appreciated.
First, let me say: this isnt a competition.
I was in no way trying to contradict your advice.
(1) I said "for small home projects where I wouldnt use a Log API"
(2) I said i use a proper logging API at work.
I was merely pointing out a VERY simple alternative given different
circumstances (a small informal project).
"ahm... it's already in the JDK. you don't need to add or configure anything."
Just reading the intro paragraph to that package gives me a headache.
"The JavaTM Logging APIs, introduced in package java.util.logging, facilitate software servicing and maintenance at customer sites by producing log reports suitable for analysis by end users, system administrators, field service engineers, and software development teams. The Logging APIs capture information such as security failures, configuration errors, performance bottlenecks, and/or bugs in the application or platform. The core package includes support for delivering plain text or XML-formatted log records to memory, output streams, consoles, files, and sockets. In addition, the logging APIs are capable of interacting with logging services that already exist on the host operating system."
I dont want any of that noise following me home! : )