diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-17 19:50:32 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-08-17 19:50:32 +0300 |
| commit | 4fcf044cc0a4265f6c9c2aad2a3a7aad92eafefa (patch) | |
| tree | a3b146dadddc5bd67350ee837af0499c53308478 /Software/Visual_Studio/Tango.Telemetry/Mappers/LogMapper.cs | |
| parent | d150ca010285dc76add9d9f5606dd6d150a610c5 (diff) | |
| download | Tango-4fcf044cc0a4265f6c9c2aad2a3a7aad92eafefa.tar.gz Tango-4fcf044cc0a4265f6c9c2aad2a3a7aad92eafefa.zip | |
Telemetry Logs & Events.
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; + } + } +} |
