PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/server/core/src/main/scala/org/infinispan/server/core/logging/Log.scala

http://github.com/infinispan/infinispan
Scala | 99 lines | 41 code | 30 blank | 28 comment | 0 complexity | 29182a92320997f0328e2c9918eae994 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2000 - 2011, Red Hat Middleware LLC, and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.infinispan.server.core.logging
  23. import org.jboss.netty.channel.Channel
  24. import java.net.SocketAddress
  25. import org.infinispan.util.logging.LogFactory
  26. /**
  27. * A logging facade for Scala code.
  28. *
  29. * @author Galder Zamarre?o
  30. * @since 5.0
  31. */
  32. trait Log {
  33. private lazy val log: JavaLog = LogFactory.getLog(getClass, classOf[JavaLog])
  34. def info(msg: => String) = log.info(msg)
  35. def info(msg: => String, param1: Any) = log.infof(msg, param1)
  36. def error(msg: => String, t: Throwable) = log.errorf(t, msg)
  37. def warn(msg: => String, t: Throwable) = log.warnf(t, msg)
  38. def debug(msg: => String) = log.debug(msg)
  39. def debug(msg: => String, param1: Any) = log.debugf(msg, param1)
  40. def debug(t: Throwable, msg: => String) = log.debugf(t, msg)
  41. def debug(t: Throwable, msg: => String, param1: Any) = log.debugf(t, msg, param1)
  42. def debug(msg: => String, param1: Any, param2: Any) =
  43. log.debugf(msg, param1, param2)
  44. def debugf(msg: => String, params: Any*) =
  45. log.debugf(msg, params.map(_.asInstanceOf[AnyRef]) : _*)
  46. def trace(msg: => String) = log.tracef(msg)
  47. def trace(msg: => String, param1: Any) = log.tracef(msg, param1)
  48. def trace(msg: => String, param1: Any, param2: Any) =
  49. log.tracef(msg, param1, param2)
  50. def trace(msg: => String, param1: Any, param2: Any, param3: Any) =
  51. log.tracef(msg, param1, param2, param3)
  52. def tracef(msg: => String, params: Any*) =
  53. log.tracef(msg, params.map(_.asInstanceOf[AnyRef]) : _*)
  54. def isDebugEnabled = log.isDebugEnabled
  55. def isTraceEnabled = log.isTraceEnabled
  56. // INFO or higher level messages support internationalization
  57. def logStartWithArgs(args: String) = log.startWithArgs(args)
  58. def logPostingShutdownRequest = log.postingShutdownRequest
  59. def logExceptionReported(t: Throwable) = log.exceptionReported(t)
  60. def logServerDidNotUnbind = log.serverDidNotUnbind
  61. def logChannelStillBound(ch: Channel, address: SocketAddress) =
  62. log.channelStillBound(ch, address)
  63. def logServerDidNotClose = log.serverDidNotClose
  64. def logChannelStillConnected(ch: Channel, address: SocketAddress) =
  65. log.channelStillConnected(ch, address)
  66. def logSettingMasterThreadsNotSupported = log.settingMasterThreadsNotSupported
  67. def logErrorBeforeReadingRequest(t: Throwable) =
  68. log.errorBeforeReadingRequest(t)
  69. }