diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Telemetry/Mappers/LogMapper.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Telemetry/Mappers/LogMapper.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Telemetry/Mappers/LogMapper.cs b/Software/Visual_Studio/Tango.Telemetry/Mappers/LogMapper.cs new file mode 100644 index 000000000..6f5abbf1b --- /dev/null +++ b/Software/Visual_Studio/Tango.Telemetry/Mappers/LogMapper.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; +using Tango.PMR.Debugging; +using Tango.Telemetry.Telemetries; + +namespace Tango.Telemetry.Mappers +{ + public class LogMapper + { + public static TelemetryLog MapLog(LogItemBase log) + { + TelemetryLog tLog = new TelemetryLog(); + tLog.Source = "Application"; + tLog.Time = DateTime.UtcNow; + tLog.Category = log.Category.ToString(); + tLog.Class = log.ClassName; + tLog.Method = log.CallerMethodName; + tLog.Line = log.CallerLineNumber; + tLog.Message = log.Message; + + return tLog; + } + + public static TelemetryLog MapLog(StartDebugLogResponse log) + { + TelemetryLog tLog = new TelemetryLog(); + tLog.Source = "Firmware"; + tLog.Time = DateTime.UtcNow; + tLog.Category = log.Category.ToString(); + tLog.Class = log.FileName; + tLog.Method = $"[{log.ModuleId}] [{log.Filter}] [{log.Parameter}]"; + tLog.Line = log.LineNumber; + tLog.Message = log.Message; + + return tLog; + } + } +} |
