Пример #1
0
        /// <summary>
        /// Underlying method actually called through to by the Matches(Object) method
        ///
        /// Simply tries to check if anything has been logged at a level above the minimum threshold specified
        /// </summary>
        /// <param name="logOutput_"></param>
        /// <returns></returns>
        public bool Matches(ILogOutput logOutput_)
        {
            var logLevelNames = Enum.GetNames(typeof(LogLevel));

            foreach (var logLevelName in logLevelNames)
            {
                var logLevel = LogLevelExtensions.Parse(logLevelName);

                if (ThresholdLogLevel >= logLevel)
                {
                    continue;
                }

                if (!logOutput_.LogMessages[logLevel].Any())
                {
                    continue;
                }

                _errorMessage.Append("Log output contains messages logged at level [");
                _errorMessage.Append(logLevel.ToLogString());
                _errorMessage.Append("] when no messages above level [");
                _errorMessage.Append(ThresholdLogLevel.ToLogString());
                _errorMessage.Append("] were expected");
                return(false);
            }

            return(true);
        }
Пример #2
0
        internal SetLoggerLevel.Response SetLoggerLevel(SetLoggerLevel.Request request)
        {
            if (request.logger == "RosSharp")
            {
                byte level;
                if (LogLevelExtensions.TryParse(request.level, out level))
                {
                    LogLevel = level;
                }
            }

            return(new SetLoggerLevel.Response());
        }