diff --git a/Source/Meadow.Logging/lib/Logger.cs b/Source/Meadow.Logging/lib/Logger.cs
index 928c8a3..0a4e5d8 100644
--- a/Source/Meadow.Logging/lib/Logger.cs
+++ b/Source/Meadow.Logging/lib/Logger.cs
@@ -32,6 +32,11 @@ public static class MessageGroup
/// Represents the application-specific log messages.
///
public const string Application = "application";
+
+ ///
+ /// Represents the log messages related to the ESP coprocessor.
+ ///
+ public const string Esp = "esp";
}
private readonly LogProviderCollection _providers = new();
@@ -44,7 +49,12 @@ public static class MessageGroup
///
/// To show message from all groups, either use `MessageGroup.All` or clear the ShowsGroups list
///
- public List ShowGroups { get; } = new();
+ public List GroupsToShow { get; } = new();
+
+ ///
+ /// Gets or sets a value indicating whether to show message groups in log messages
+ ///
+ public bool ShowGroup { get; set; } = true;
///
/// Gets or sets a value indicating whether to show ticks in log messages
@@ -62,7 +72,7 @@ public static class MessageGroup
/// A collection of providers to add to the Logger
public Logger(params ILogProvider[] providers)
{
- ShowGroups.Add(MessageGroup.Application);
+ GroupsToShow.Add(MessageGroup.Application);
foreach (var p in providers)
{
@@ -220,10 +230,10 @@ private void Log(LogLevel level, string message, string? messageGroup)
if (messageGroup == null) messageGroup = MessageGroup.Application;
- if (ShowGroups.Count > 0)
+ if (GroupsToShow.Count > 0)
{
- if (!ShowGroups.Contains(MessageGroup.All)
- && !ShowGroups.Contains(messageGroup))
+ if (!GroupsToShow.Contains(MessageGroup.All)
+ && !GroupsToShow.Contains(messageGroup))
{
return;
}
@@ -238,6 +248,11 @@ private void Log(LogLevel level, string message, string? messageGroup)
now = TimeSpan.FromMilliseconds(Environment.TickCount - _startupTicks);
}
+ if (ShowGroup && messageGroup != null)
+ {
+ message = $"[{messageGroup}] {message}";
+ }
+
foreach (var p in _providers)
{
if (now != null)