Skip to content

Instantly share code, notes, and snippets.

@Jire
Created June 22, 2011 17:05
Show Gist options
  • Save Jire/1040568 to your computer and use it in GitHub Desktop.
Save Jire/1040568 to your computer and use it in GitHub Desktop.
import static java.lang.System.out;
/**
* Advanced logging utility with node support.
* @author Thomas Nappo
*/
public class Logger {
/**
* Prints a String and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(String)}</code> and then
* <code>{@link #println()}</code>.
*
* @param x The <code>String</code> to be printed.
*/
public static void println(String x) {
out.println(x);
}
/**
* Prints a node to the command line.
*
* <p>Nodes are outputted as so:
* <pre>Outputting example nodes:
* - example node 1
* - example node 2</pre></p>
*
* @param n The node's text.
*/
public static void printn(String n) {
out.println(" - " + n);
}
/**
* Prints a subnode to the command line.
*
* <p>Subnodes are outputted as so:
* <pre>Outputting example nodes:
* - example node 1
* * example subnode 1
* * example subnode 2
* - example node 2
* * example subnode 1</pre></p>
*
* @param sn The subnode's text.
*/
public static void printsn(String sn) {
out.println(" * " + sn);
}
/**
* Prints a string. If the argument is <code>null</code> then the string
* <code>"null"</code> is printed. Otherwise, the string's characters are
* converted into bytes according to the platform's default character
* encoding, and these bytes are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
*
* @param s The <code>String</code> to be printed
*/
public static void print(String s) {
out.print(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment