123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- namespace Apache.NMS
- {
- public sealed class Tracer
- {
- private static ITrace s_trace = null;
- // prevent instantiation of this class. All methods are static.
- private Tracer()
- {
- }
- public static ITrace Trace
- {
- get { return s_trace; }
- set { s_trace = value; }
- }
- public static bool IsDebugEnabled
- {
- get { return s_trace != null && s_trace.IsDebugEnabled; }
- }
- public static bool IsInfoEnabled
- {
- get { return s_trace != null && s_trace.IsInfoEnabled; }
- }
- public static bool IsWarnEnabled
- {
- get { return s_trace != null && s_trace.IsWarnEnabled; }
- }
- public static bool IsErrorEnabled
- {
- get { return s_trace != null && s_trace.IsErrorEnabled; }
- }
- public static bool IsFatalEnabled
- {
- get { return s_trace != null && s_trace.IsFatalEnabled; }
- }
- public static void Debug(object message)
- {
- if (IsDebugEnabled)
- {
- s_trace.Debug(message.ToString());
- }
- }
- public static void DebugFormat(string format, params object[] args)
- {
- if (IsDebugEnabled)
- {
- s_trace.Debug(string.Format(format, args));
- }
- }
- public static void Info(object message)
- {
- if (IsInfoEnabled)
- {
- s_trace.Info(message.ToString());
- }
- }
- public static void InfoFormat(string format, params object[] args)
- {
- if (IsInfoEnabled)
- {
- s_trace.Info(string.Format(format, args));
- }
- }
- public static void Warn(object message)
- {
- if (IsWarnEnabled)
- {
- s_trace.Warn(message.ToString());
- }
- }
- public static void WarnFormat(string format, params object[] args)
- {
- if (IsWarnEnabled)
- {
- s_trace.Warn(string.Format(format, args));
- }
- }
- public static void Error(object message)
- {
- if (IsErrorEnabled)
- {
- s_trace.Error(message.ToString());
- }
- }
- public static void ErrorFormat(string format, params object[] args)
- {
- if (IsErrorEnabled)
- {
- s_trace.Error(string.Format(format, args));
- }
- }
- public static void Fatal(object message)
- {
- if (IsFatalEnabled)
- {
- s_trace.Fatal(message.ToString());
- }
- }
- public static void FatalFormat(string format, params object[] args)
- {
- if (IsFatalEnabled)
- {
- s_trace.Fatal(string.Format(format, args));
- }
- }
- }
- }
|