diff --git a/akka-actor/src/main/scala/akka/event/Logging.scala b/akka-actor/src/main/scala/akka/event/Logging.scala index fee55f2acb..f7b5025c8d 100644 --- a/akka-actor/src/main/scala/akka/event/Logging.scala +++ b/akka-actor/src/main/scala/akka/event/Logging.scala @@ -823,42 +823,160 @@ trait LoggingAdapter { * The rest is just the widening of the API for the user's convenience. */ + /** + * Log message at error level, including the exception that caused the error. + * @see [[LoggingAdapter]] + */ def error(cause: Throwable, message: String): Unit = { if (isErrorEnabled) notifyError(cause, message) } + /** + * Message template with 1 replacement argument. + * @see [[LoggingAdapter]] + */ def error(cause: Throwable, template: String, arg1: Any): Unit = { if (isErrorEnabled) notifyError(cause, format1(template, arg1)) } + /** + * Message template with 2 replacement arguments. + * @see [[LoggingAdapter]] + */ def error(cause: Throwable, template: String, arg1: Any, arg2: Any): Unit = { if (isErrorEnabled) notifyError(cause, format(template, arg1, arg2)) } + /** + * Message template with 3 replacement arguments. + * @see [[LoggingAdapter]] + */ def error(cause: Throwable, template: String, arg1: Any, arg2: Any, arg3: Any): Unit = { if (isErrorEnabled) notifyError(cause, format(template, arg1, arg2, arg3)) } + /** + * Message template with 4 replacement arguments. + * @see [[LoggingAdapter]] + */ def error(cause: Throwable, template: String, arg1: Any, arg2: Any, arg3: Any, arg4: Any): Unit = { if (isErrorEnabled) notifyError(cause, format(template, arg1, arg2, arg3, arg4)) } + /** + * Log message at error level, without providing the exception that caused the error. + * @see [[LoggingAdapter]] + */ def error(message: String): Unit = { if (isErrorEnabled) notifyError(message) } + /** + * Message template with 1 replacement argument. + * @see [[LoggingAdapter]] + */ def error(template: String, arg1: Any): Unit = { if (isErrorEnabled) notifyError(format1(template, arg1)) } + /** + * Message template with 2 replacement arguments. + * @see [[LoggingAdapter]] + */ def error(template: String, arg1: Any, arg2: Any): Unit = { if (isErrorEnabled) notifyError(format(template, arg1, arg2)) } + /** + * Message template with 3 replacement arguments. + * @see [[LoggingAdapter]] + */ def error(template: String, arg1: Any, arg2: Any, arg3: Any): Unit = { if (isErrorEnabled) notifyError(format(template, arg1, arg2, arg3)) } + /** + * Message template with 4 replacement arguments. + * @see [[LoggingAdapter]] + */ def error(template: String, arg1: Any, arg2: Any, arg3: Any, arg4: Any): Unit = { if (isErrorEnabled) notifyError(format(template, arg1, arg2, arg3, arg4)) } + /** + * Log message at warning level. + * @see [[LoggingAdapter]] + */ def warning(message: String): Unit = { if (isWarningEnabled) notifyWarning(message) } + /** + * Message template with 1 replacement argument. + * @see [[LoggingAdapter]] + */ def warning(template: String, arg1: Any): Unit = { if (isWarningEnabled) notifyWarning(format1(template, arg1)) } + /** + * Message template with 2 replacement arguments. + * @see [[LoggingAdapter]] + */ def warning(template: String, arg1: Any, arg2: Any): Unit = { if (isWarningEnabled) notifyWarning(format(template, arg1, arg2)) } + /** + * Message template with 3 replacement arguments. + * @see [[LoggingAdapter]] + */ def warning(template: String, arg1: Any, arg2: Any, arg3: Any): Unit = { if (isWarningEnabled) notifyWarning(format(template, arg1, arg2, arg3)) } + /** + * Message template with 4 replacement arguments. + * @see [[LoggingAdapter]] + */ def warning(template: String, arg1: Any, arg2: Any, arg3: Any, arg4: Any): Unit = { if (isWarningEnabled) notifyWarning(format(template, arg1, arg2, arg3, arg4)) } + /** + * Log message at info level. + * @see [[LoggingAdapter]] + */ def info(message: String) { if (isInfoEnabled) notifyInfo(message) } + /** + * Message template with 1 replacement argument. + * @see [[LoggingAdapter]] + */ def info(template: String, arg1: Any): Unit = { if (isInfoEnabled) notifyInfo(format1(template, arg1)) } + /** + * Message template with 2 replacement arguments. + * @see [[LoggingAdapter]] + */ def info(template: String, arg1: Any, arg2: Any): Unit = { if (isInfoEnabled) notifyInfo(format(template, arg1, arg2)) } + /** + * Message template with 3 replacement arguments. + * @see [[LoggingAdapter]] + */ def info(template: String, arg1: Any, arg2: Any, arg3: Any): Unit = { if (isInfoEnabled) notifyInfo(format(template, arg1, arg2, arg3)) } + /** + * Message template with 4 replacement arguments. + * @see [[LoggingAdapter]] + */ def info(template: String, arg1: Any, arg2: Any, arg3: Any, arg4: Any): Unit = { if (isInfoEnabled) notifyInfo(format(template, arg1, arg2, arg3, arg4)) } + /** + * Log message at debug level. + * @see [[LoggingAdapter]] + */ def debug(message: String) { if (isDebugEnabled) notifyDebug(message) } + /** + * Message template with 1 replacement argument. + * @see [[LoggingAdapter]] + */ def debug(template: String, arg1: Any): Unit = { if (isDebugEnabled) notifyDebug(format1(template, arg1)) } + /** + * Message template with 2 replacement arguments. + * @see [[LoggingAdapter]] + */ def debug(template: String, arg1: Any, arg2: Any): Unit = { if (isDebugEnabled) notifyDebug(format(template, arg1, arg2)) } + /** + * Message template with 3 replacement arguments. + * @see [[LoggingAdapter]] + */ def debug(template: String, arg1: Any, arg2: Any, arg3: Any): Unit = { if (isDebugEnabled) notifyDebug(format(template, arg1, arg2, arg3)) } + /** + * Message template with 4 replacement arguments. + * @see [[LoggingAdapter]] + */ def debug(template: String, arg1: Any, arg2: Any, arg3: Any, arg4: Any): Unit = { if (isDebugEnabled) notifyDebug(format(template, arg1, arg2, arg3, arg4)) } + /** + * Log message at the specified log level. + */ def log(level: Logging.LogLevel, message: String) { if (isEnabled(level)) notifyLog(level, message) } + /** + * Message template with 1 replacement argument. + */ def log(level: Logging.LogLevel, template: String, arg1: Any): Unit = { if (isEnabled(level)) notifyLog(level, format1(template, arg1)) } + /** + * Message template with 2 replacement arguments. + */ def log(level: Logging.LogLevel, template: String, arg1: Any, arg2: Any): Unit = { if (isEnabled(level)) notifyLog(level, format(template, arg1, arg2)) } + /** + * Message template with 3 replacement arguments. + */ def log(level: Logging.LogLevel, template: String, arg1: Any, arg2: Any, arg3: Any): Unit = { if (isEnabled(level)) notifyLog(level, format(template, arg1, arg2, arg3)) } + /** + * Message template with 4 replacement arguments. + */ def log(level: Logging.LogLevel, template: String, arg1: Any, arg2: Any, arg3: Any, arg4: Any): Unit = { if (isEnabled(level)) notifyLog(level, format(template, arg1, arg2, arg3, arg4)) } + /** + * @return true if the specified log level is enabled + */ final def isEnabled(level: Logging.LogLevel): Boolean = level match { case Logging.ErrorLevel ⇒ isErrorEnabled case Logging.WarningLevel ⇒ isWarningEnabled @@ -898,7 +1016,10 @@ trait LoggingAdapter { sb.append(rest).toString } } -//FIXME DOCUMENT + +/** + * [[LoggingAdapter]] that publishes [[akka.event.Logging.LogEvent]] to event stream. + */ class BusLogging(val bus: LoggingBus, val logSource: String, val logClass: Class[_]) extends LoggingAdapter { import Logging._