Skip to content

Writing logger adapters to orman

ahmetalpbalkan edited this page Jun 4, 2011 · 1 revision

You are welcomed to implement different logging system adapters for ORMAN.

All logging adapters implement the Java interface ILogger, it is like:

public interface ILogger {
	public void setLevel(LoggingLevel level);
	public void trace(String message, Object... params);
	public void debug(String message, Object... params);
	public void info(String message, Object... params);
	public void warn(String message, Object... params);
	public void error(String message, Object... params);
	public void fatal(String message, Object... params);
}

A few points to consider while implementing logging adapter:

  • You should get logging configuration in the constructor of adapter if needed.
  • You should set a default logging level in the constructor.
  • setLevel() method should keep the given level in adapter class as a field.
  • You should obey priority of logging levels and do not log events with level below the threshold (set by setLevel()) unless documented.
  • You can use String.format(message, params) to have formatted log message as String.
  • You should write Javadoc for your adapter class.

Clone this wiki locally