internal LogData(WebSocketSharp.LogLevel level, StackFrame caller, string message)
 {
     this._level   = level;
     this._caller  = caller;
     this._message = message ?? string.Empty;
     this._date    = DateTime.Now;
 }
Example #2
0
 public Logger(WebSocketSharp.LogLevel level, string file, Action <LogData, string> output)
 {
     this._level  = level;
     this._file   = file;
     this._output = output ?? new Action <LogData, string>(Logger.defaultOutput);
     this._sync   = new object();
 }
Example #3
0
        private void output(string message, WebSocketSharp.LogLevel level)
        {
            object obj = this._sync;

            Monitor.Enter(obj);
            try
            {
                if (this._level <= level)
                {
                    LogData logDatum = null;
                    try
                    {
                        logDatum = new LogData(level, new StackFrame(2, true), message);
                        this._output(logDatum, this._file);
                    }
                    catch (Exception exception1)
                    {
                        Exception exception = exception1;
                        logDatum = new LogData(WebSocketSharp.LogLevel.Fatal, new StackFrame(0, true), exception.Message);
                        Console.WriteLine(logDatum.ToString());
                    }
                }
            }
            finally
            {
                Monitor.Exit(obj);
            }
        }
Example #4
0
 public Logger(WebSocketSharp.LogLevel level) : this(level, null, null)
 {
 }
Example #5
0
 public static void SetLevel(WebSocketSharp.LogLevel level)
 {
     _getInstance().Level = level;
 }