示例#1
0
 void send(LoggerSet logger, LogLevelSet logLevel, string message)
 {
     message = _defaultFormatter.FormatMessage(logger, logLevel, message);
     message = _timestampFormatter.FormatMessage(logger, logLevel, message);
     message = _colorFormatter.FormatMessage(logLevel, message);
     _socket.Send(logLevel, message);
 }
示例#2
0
 void Start()
 {
     if (catchUnityLogs)
     {
         _unityLog = LoggerFactory.GetLogger("Unity");
         Application.logMessageReceived += onLog;
         //  Application.logMessageReceivedThreaded += onLog;
     }
 }
示例#3
0
 void log(LoggerSet logger, LogLevelSet logLevel, string message)
 {
     //message = _defaultFormatter.FormatMessage(logger, logLevel, message);
     Debug.Log(message);
     if (logLevel <= LogLevelSet.Info)
     {
         Debug.Log(message);
     }
     else if (logLevel == LogLevelSet.Warn)
     {
         Debug.LogWarning(message);
     }
     else
     {
         Debug.LogError(message);
     }
 }
示例#4
0
        /// <summary>
        /// Removes a logger from the collection.
        /// </summary>
        /// <param name="logId">Id of the logger to remove.</param>
        public Result Remove(string logId)
        {
            try
            {
                if (string.IsNullOrEmpty(logId) || !LoggerSet.ContainsKey(logId))
                {
                    return(Result.SingleWarning(Warnings.LoggerDoesNotExist, logId));
                }

                LoggerSet.Remove(logId);
                return(Result.Success);
            }
            catch (Exception e)
            {
                return(Result.Error(e));
            }
        }
示例#5
0
        /// <summary>
        /// Adds a single logger to the collection.
        /// </summary>
        /// <param name="logger">Logger to add.</param>
        public Result Add(IResultLogger logger)
        {
            if (ReferenceEquals(logger, null))
            {
                return(Result.SingleError(Errors.AddingNullLoggerToCollection));
            }

            try
            {
                var key = logger.Id;
                if (LoggerSet.ContainsKey(key))
                {
                    return(Result.SingleWarning(Warnings.LoggerAlreadyExists, key));
                }

                LoggerSet.Add(key, logger);
                return(Result.Success);
            }
            catch (Exception e)
            {
                return(Result.Error(e));
            }
        }
 void send(LoggerSet logger, LogLevelSet logLevel, string message)
 {
     _socket.Send(logLevel, message);
 }