public void Log(InternalLogLevel level, string msg)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
                this.Trace(msg);
                break;

            case InternalLogLevel.DEBUG:
                this.Debug(msg);
                break;

            case InternalLogLevel.INFO:
                this.Info(msg);
                break;

            case InternalLogLevel.WARN:
                this.Warn(msg);
                break;

            case InternalLogLevel.ERROR:
                this.Error(msg);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public void Log(InternalLogLevel level, string format, params object[] arguments)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
                this.Trace(format, arguments);
                break;

            case InternalLogLevel.DEBUG:
                this.Debug(format, arguments);
                break;

            case InternalLogLevel.INFO:
                this.Info(format, arguments);
                break;

            case InternalLogLevel.WARN:
                this.Warn(format, arguments);
                break;

            case InternalLogLevel.ERROR:
                this.Error(format, arguments);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #3
0
        public void Log(InternalLogLevel level, string format, object argA, object argB)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
                this.Trace(format, argA, argB);
                break;

            case InternalLogLevel.DEBUG:
                this.Debug(format, argA, argB);
                break;

            case InternalLogLevel.INFO:
                this.Info(format, argA, argB);
                break;

            case InternalLogLevel.WARN:
                this.Warn(format, argA, argB);
                break;

            case InternalLogLevel.ERROR:
                this.Error(format, argA, argB);
                break;

            default:
                ThrowHelper.ThrowArgumentOutOfRangeException(); break;
            }
        }
Пример #4
0
        protected virtual void LogInternal(InternalLogLevel level, string message)
        {
            message = LeSignature + message;
            switch (level)
            {
            case InternalLogLevel.Debug: if (LogInternalDebug != null)
                {
                    LogInternalDebug(message);
                }
                break;

            case InternalLogLevel.Info:  if (LogInternalInfo != null)
                {
                    LogInternalInfo(message);
                }
                break;

            case InternalLogLevel.Warn:  if (LogInternalWarn != null)
                {
                    LogInternalWarn(message);
                }
                break;

            case InternalLogLevel.Error: if (LogInternalError != null)
                {
                    LogInternalError(message);
                }
                break;
            }

            if (m_Debug)
            {
                Debug.WriteLine(message);
            }
        }
Пример #5
0
        public void Log(InternalLogLevel level, Exception cause)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
                this.Trace(cause);
                break;

            case InternalLogLevel.DEBUG:
                this.Debug(cause);
                break;

            case InternalLogLevel.INFO:
                this.Info(cause);
                break;

            case InternalLogLevel.WARN:
                this.Warn(cause);
                break;

            case InternalLogLevel.ERROR:
                this.Error(cause);
                break;

            default:
                ThrowHelper.ThrowArgumentOutOfRangeException(); break;
            }
        }
Пример #6
0
        /// <summary>
        ///     Creates a new instance with the specified logger name.
        /// </summary>
        /// <param name="name">the name of the class to use for the logger</param>
        /// <param name="level">the log level</param>
        public XmppLoggingHandler(string name, LogLevel level)
        {
            Contract.Requires <ArgumentNullException>(name != null, $"{nameof(name)} cannot be null");

            Logger        = InternalLoggerFactory.GetInstance(name);
            Level         = level;
            InternalLevel = level.ToInternalLevel();
        }
Пример #7
0
 private Http2FrameLogger(InternalLogLevel level, IInternalLogger logger)
 {
     if (logger is null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.logger);
     }
     _level  = level;
     _logger = logger;
 }
Пример #8
0
        /// <summary>
        ///     Creates a new instance with the specified logger name.
        /// </summary>
        /// <param name="type">the class type to generate the logger for</param>
        /// <param name="level">the log level</param>
        public LoggingHandler(Type type, LogLevel level)
        {
            if (type == null)
            {
                throw new NullReferenceException("type");
            }

            this.Logger = InternalLoggerFactory.GetInstance(type);
            this.Level = level;
            this.InternalLevel = level.ToInternalLevel();
        }
        /// <summary>
        ///     Creates a new instance with the specified logger name.
        /// </summary>
        /// <param name="type">the class type to generate the logger for</param>
        /// <param name="level">the log level</param>
        public LoggingHandler(Type type, LogLevel level)
        {
            if (type == null)
            {
                throw new NullReferenceException("type");
            }

            this.Logger        = InternalLoggerFactory.GetInstance(type);
            this.Level         = level;
            this.InternalLevel = level.ToInternalLevel();
        }
        /// <summary>
        ///     Creates a new instance with the specified logger name.
        /// </summary>
        /// <param name="name">the name of the class to use for the logger</param>
        /// <param name="level">the log level</param>
        public LoggingHandler(string name, LogLevel level)
        {
            if (name == null)
            {
                throw new NullReferenceException("name");
            }

            this.Logger        = InternalLoggerFactory.GetInstance(name);
            this.Level         = level;
            this.InternalLevel = level.ToInternalLevel();
        }
Пример #11
0
        /// <summary>
        ///     Creates a new instance with the specified logger name.
        /// </summary>
        /// <param name="type">the class type to generate the logger for</param>
        /// <param name="level">the log level</param>
        /// <param name="bufferFormat">the ByteBuf format</param>
        public LoggingHandler(Type type, LogLevel level, ByteBufferFormat bufferFormat)
        {
            if (type is null)
            {
                ThrowHelper.ThrowNullReferenceException(ExceptionArgument.type);
            }

            Logger        = InternalLoggerFactory.GetInstance(type);
            Level         = level;
            InternalLevel = level.ToInternalLevel();
            BufferFormat  = bufferFormat;
        }
Пример #12
0
 internal static void OnUnityLog(InternalLogLevel logLevel, IntPtr message, IntPtr parts)
 {
     try
     {
         OnUnityInternalLog?.Invoke(null, new UnityLogEventArgs
         {
             LogLevel = logLevel,
             Message  = LibcHelper.Format(message, parts)
         });
     }
     catch (Exception e)
     {
         File.WriteAllText($"unity_logger_err_{DateTime.Now.Ticks}.txt", e.ToString());
     }
 }
Пример #13
0
 public bool IsEnabled(InternalLogLevel level)
 {
     switch (level)
     {
         case InternalLogLevel.TRACE:
             return this.TraceEnabled;
         case InternalLogLevel.DEBUG:
             return this.DebugEnabled;
         case InternalLogLevel.INFO:
             return this.InfoEnabled;
         case InternalLogLevel.WARN:
             return this.WarnEnabled;
         case InternalLogLevel.ERROR:
             return this.ErrorEnabled;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Пример #14
0
        public void Log(InternalLogLevel level, string msg)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
            case InternalLogLevel.DEBUG:
                DebugUtility.LogVerbose(m_Name, msg);
                break;

            case InternalLogLevel.INFO:
                DebugUtility.Log(m_Name, msg);
                break;

            case InternalLogLevel.WARN:
                DebugUtility.LogWarning(m_Name, msg);
                break;

            case InternalLogLevel.ERROR:
                DebugUtility.LogError(m_Name, msg);
                break;
            }
        }
Пример #15
0
        public void Log(InternalLogLevel level, string format, params object[] arguments)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
            case InternalLogLevel.DEBUG:
                DebugUtility.LogVerbose(m_Name, MyStringFormat(format, arguments));
                break;

            case InternalLogLevel.INFO:
                DebugUtility.Log(m_Name, MyStringFormat(format, arguments));
                break;

            case InternalLogLevel.WARN:
                DebugUtility.LogWarning(m_Name, MyStringFormat(format, arguments));
                break;

            case InternalLogLevel.ERROR:
                DebugUtility.LogError(m_Name, MyStringFormat(format, arguments));
                break;
            }
        }
Пример #16
0
        public void Log(InternalLogLevel level, string msg, Exception t)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
            case InternalLogLevel.DEBUG:
                DebugUtility.LogVerbose(m_Name, $"{msg}\n{t.ToString()}");
                break;

            case InternalLogLevel.INFO:
                DebugUtility.Log(m_Name, $"{msg}\n{t.ToString()}");
                break;

            case InternalLogLevel.WARN:
                DebugUtility.LogWarning(m_Name, $"{msg}\n{t.ToString()}");
                break;

            case InternalLogLevel.ERROR:
                DebugUtility.LogError(m_Name, $"{msg}\n{t.ToString()}");
                break;
            }
        }
        public bool IsEnabled(InternalLogLevel level)
        {
            switch (level)
            {
            case InternalLogLevel.TRACE:
                return(this.TraceEnabled);

            case InternalLogLevel.DEBUG:
                return(this.DebugEnabled);

            case InternalLogLevel.INFO:
                return(this.InfoEnabled);

            case InternalLogLevel.WARN:
                return(this.WarnEnabled);

            case InternalLogLevel.ERROR:
                return(this.ErrorEnabled);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #18
0
        public bool IsEnabled(InternalLogLevel level)
        {
            switch (level)
            {
            case InternalLogLevel.DEBUG:
                return(m_DebugEnabled);

            case InternalLogLevel.TRACE:
                return(m_TraceEnabled);

            case InternalLogLevel.INFO:
                return(m_InfoEnabled);

            case InternalLogLevel.WARN:
                return(m_WarnEnabled);

            case InternalLogLevel.ERROR:
                return(m_ErrorEnabled);

            default:
                return(false);
            }
        }
Пример #19
0
 public Http2FrameLogger(InternalLogLevel level, Type type)
     : this(level, InternalLoggerFactory.GetInstance(type))
 {
 }
Пример #20
0
 public Http2FrameLogger(InternalLogLevel level, string name)
     : this(level, InternalLoggerFactory.GetInstance(name))
 {
 }
Пример #21
0
 public Http2FrameLogger(InternalLogLevel level)
     : this(level, InternalLoggerFactory.GetInstance <Http2FrameLogger>())
 {
 }
Пример #22
0
 public void Log(InternalLogLevel level, string format, params object[] arguments)
 {
     throw new NotImplementedException();
 }
Пример #23
0
 private void log(InternalLogLevel logLevel, object msg)
 {
     Logger.Log(logLevel, msg?.ToString());
 }
Пример #24
0
 /// <summary>
 /// Gets a value indicating whether logging is enabled for the specified level.
 /// </summary>
 /// <param name="level">Log level to be checked.</param>
 /// <returns>A value of <see langword="true" /> if logging is enabled for the specified level, otherwise it returns <see langword="false" />.</returns>
 private bool IsEnabled(LogLevels level)
 {
     return(InternalLogLevel.Has(level));
 }
Пример #25
0
 public void Log(InternalLogLevel level, string msg)
 {
     switch (level)
     {
         case InternalLogLevel.TRACE:
             this.Trace(msg);
             break;
         case InternalLogLevel.DEBUG:
             this.Debug(msg);
             break;
         case InternalLogLevel.INFO:
             this.Info(msg);
             break;
         case InternalLogLevel.WARN:
             this.Warn(msg);
             break;
         case InternalLogLevel.ERROR:
             this.Error(msg);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Пример #26
0
 public bool IsEnabled(InternalLogLevel level) => true;
Пример #27
0
 public void Log(InternalLogLevel level, Exception t) => Console.WriteLine("Log-level[" + level + "]: " + t);
Пример #28
0
 public void Log(InternalLogLevel level, string msg, Exception t) => Console.WriteLine("Log-level[" + level + "]: " + msg + ", exception: " + t);
Пример #29
0
 public void Log(InternalLogLevel level, string format, params object[] arguments) => Console.WriteLine("Log-level[" + level + "]: " + format, arguments);
Пример #30
0
 public void Log(InternalLogLevel level, string format, object argA, object argB) => Console.WriteLine("Log-level[" + level + "]: " + format, argA, argB);
Пример #31
0
        /// <summary>
        ///     Creates a new instance with the specified logger name.
        /// </summary>
        /// <param name="name">the name of the class to use for the logger</param>
        /// <param name="level">the log level</param>
        public LoggingHandler(string name, LogLevel level)
        {
            if (name == null)
            {
                throw new NullReferenceException("name");
            }

            this.Logger = InternalLoggerFactory.GetInstance(name);
            this.Level = level;
            this.InternalLevel = level.ToInternalLevel();
        }
Пример #32
0
 public override bool isEnabled(InternalLogLevel level)
 {
     return(level != InternalLogLevel.DEBUG || DebugEnabled);
 }
Пример #33
0
 public void Log(InternalLogLevel level, Exception t)
 {
     throw new NotImplementedException();
 }
Пример #34
0
 public void Log(InternalLogLevel level, string msg) => Console.WriteLine("Log-level[" + level + "]: " + msg);
Пример #35
0
 public void Log(InternalLogLevel level, string format, params object[] arguments)
 {
     switch (level)
     {
         case InternalLogLevel.TRACE:
             this.Trace(format, arguments);
             break;
         case InternalLogLevel.DEBUG:
             this.Debug(format, arguments);
             break;
         case InternalLogLevel.INFO:
             this.Info(format, arguments);
             break;
         case InternalLogLevel.WARN:
             this.Warn(format, arguments);
             break;
         case InternalLogLevel.ERROR:
             this.Error(format, arguments);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }