title: Java conditional logging with the logging API
body: <p>I understand that I can use</p>
  
  <pre><code>Logger.setLevel(&lt;level here&gt;);
  </code></pre>
  
  <p>To set the level of logging (turn it off, turn it on, etc). However, I'm not sure how I can conditionally log based on the log level the user specifies.</p>
  
  <p>In essence, I have a class that uses the logging API. I wish to give the user of the class the power to configure the log level how they please. I've seen this done with log4j but not with the logging API.</p>
  
  <p>Is there a best practice for this? Should I just have some function</p>
  
  <pre><code>setLogLevel()
  </code></pre>
  
  <p>that the user can pass a Level.INFO or whatever to? Or is there a better way?</p>
  
  <p>Thank you! </p>