private static void _rosout(object format, object[] args, RosOutAppender.ROSOUT_LEVEL level, CallerInfo callerInfo) { using (logger.BeginScope(nameof(_rosout))) { if (format == null) { throw new ArgumentNullException(nameof(format)); } string text = (args == null || args.Length == 0) ? format.ToString() : string.Format((string)format, args); LogLevel logLevel = LogLevel.Debug; switch (level) { case RosOutAppender.ROSOUT_LEVEL.DEBUG: logLevel = LogLevel.Debug; break; case RosOutAppender.ROSOUT_LEVEL.INFO: logLevel = LogLevel.Information; break; case RosOutAppender.ROSOUT_LEVEL.WARN: logLevel = LogLevel.Warning; break; case RosOutAppender.ROSOUT_LEVEL.ERROR: logLevel = LogLevel.Error; break; case RosOutAppender.ROSOUT_LEVEL.FATAL: logLevel = LogLevel.Critical; break; } logger.Log(logLevel, ROSOUT_FMAT, ROSOUT_PREFIX[level], text); RosOutAppender.Instance.Append(text, level, callerInfo); } }
private static void _rosout(object format, object[] args, RosOutAppender.ROSOUT_LEVEL level, CallerInfo callerInfo) { using (logger.BeginScope(nameof(_rosout))) { if (format == null) { throw new ArgumentNullException(nameof(format)); } string text = (args == null || args.Length == 0) ? format.ToString() : string.Format((string)format, args); bool printit = true; if (level == RosOutAppender.ROSOUT_LEVEL.DEBUG) { #if !DEBUG printit = false; #endif } if (printit) { logger.LogDebug(ROSOUT_FMAT, ROSOUT_PREFIX[level], text); } RosOutAppender.Instance.Append(text, level, callerInfo); } }