(TM measurement, WritePrecision precision)
}
else
{
- Trace.WriteLine($"{value} is not supported as Timestamp");
+ Trace.WriteLine($"{value} is not supported as Timestamp",
+ InfluxDBTraceFilter.CategoryInfluxError);
}
}
else
diff --git a/Client/Internal/RetryAttempt.cs b/Client/Internal/RetryAttempt.cs
index d274ee9da..0d7eb2415 100644
--- a/Client/Internal/RetryAttempt.cs
+++ b/Client/Internal/RetryAttempt.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
+using InfluxDB.Client.Core;
using InfluxDB.Client.Core.Exceptions;
namespace InfluxDB.Client.Internal
@@ -141,7 +142,8 @@ internal long GetRetryInterval()
var retryInterval = (long)(rangeStart + (rangeStop - rangeStart) * _random.NextDouble());
Trace.WriteLine("The InfluxDB does not specify \"Retry-After\". " +
- $"Use the default retryInterval: {retryInterval}");
+ $"Use the default retryInterval: {retryInterval}"
+ , InfluxDBTraceFilter.CategoryInflux);
return retryInterval;
}
diff --git a/Client/README.md b/Client/README.md
index 83e23b9b4..4665d60c6 100644
--- a/Client/README.md
+++ b/Client/README.md
@@ -769,6 +769,33 @@ namespace Examples
}
```
+## Filter trace verbose
+
+You can filter out verbose messages from `InfluxDB.Client` by using TraceListener.
+
+```cs
+using System;
+using System.Diagnostics;
+using InfluxDB.Client.Core;
+
+namespace Examples
+{
+ public static class MyProgram
+ {
+ public static void Main()
+ {
+ TraceListener ConsoleOutListener = new TextWriterTraceListener(Console.Out)
+ {
+ Filter = CategoryTraceFilter.SuppressInfluxVerbose(),
+ };
+ Trace.Listeners.Add(ConsoleOutListener);
+
+ // My code ...
+ }
+ }
+}
+````
+
## Management API
The client has following management API:
diff --git a/Client/UsersApi.cs b/Client/UsersApi.cs
index bb4899a24..2b9aa2226 100644
--- a/Client/UsersApi.cs
+++ b/Client/UsersApi.cs
@@ -307,7 +307,7 @@ public async Task MeUpdatePasswordAsync(string oldPassword, string newPassword,
var me = await MeAsync(cancellationToken).ConfigureAwait(false);
if (me == null)
{
- Trace.WriteLine("User is not authenticated.");
+ Trace.WriteLine("User is not authenticated.", InfluxDBTraceFilter.CategoryInfluxError);
return;
}
diff --git a/Client/WriteApi.cs b/Client/WriteApi.cs
index 944e2cf81..bff60a8e1 100644
--- a/Client/WriteApi.cs
+++ b/Client/WriteApi.cs
@@ -300,14 +300,17 @@ protected internal WriteApi(
switch (notification.Kind)
{
case NotificationKind.OnNext:
- Trace.WriteLine($"The batch item: {notification} was processed successfully.");
+ Trace.WriteLine($"The batch item: {notification} was processed successfully."
+ , InfluxDBTraceFilter.CategoryInfluxWrite);
break;
case NotificationKind.OnError:
Trace.WriteLine(
- $"The batch item wasn't processed successfully because: {notification.Exception}");
+ $"The batch item wasn't processed successfully because: {notification.Exception}"
+ , InfluxDBTraceFilter.CategoryInfluxWriteError);
break;
default:
- Trace.WriteLine($"The batch item: {notification} was processed");
+ Trace.WriteLine($"The batch item: {notification} was processed"
+ , InfluxDBTraceFilter.CategoryInfluxWrite);
break;
}
},
@@ -315,12 +318,14 @@ protected internal WriteApi(
{
Publish(new WriteRuntimeExceptionEvent(exception));
_disposed = true;
- Trace.WriteLine($"The unhandled exception occurs: {exception}");
+ Trace.WriteLine($"The unhandled exception occurs: {exception}"
+ , InfluxDBTraceFilter.CategoryInfluxWriteError);
},
() =>
{
_disposed = true;
- Trace.WriteLine("The WriteApi was disposed.");
+ Trace.WriteLine("The WriteApi was disposed."
+ , InfluxDBTraceFilter.CategoryInfluxWrite);
});
}
@@ -337,7 +342,7 @@ internal void ReleaseAndClose(int millis = 30000)
{
_unsubscribeDisposeCommand.Dispose(); // avoid duplicate call to dispose
- Trace.WriteLine("Flushing batches before shutdown.");
+ Trace.WriteLine("Flushing batches before shutdown.", InfluxDBTraceFilter.CategoryInfluxWrite);
if (!_subject.IsDisposed)
{
@@ -572,7 +577,8 @@ internal override string ToLineProtocol()
{
if (!_point.HasFields())
{
- Trace.WriteLine($"The point: ${_point} doesn't contains any fields, skipping");
+ Trace.WriteLine($"The point: ${_point} doesn't contains any fields, skipping",
+ InfluxDBTraceFilter.CategoryInfluxWrite);
return null;
}
@@ -603,7 +609,8 @@ internal override string ToLineProtocol()
var point = _converter.ConvertToPointData(_measurement, Options.Precision);
if (!point.HasFields())
{
- Trace.WriteLine($"The point: ${point} doesn't contains any fields, skipping");
+ Trace.WriteLine($"The point: ${point} doesn't contains any fields, skipping",
+ InfluxDBTraceFilter.CategoryInfluxWrite);
return null;
}
diff --git a/Client/WriteApiAsync.cs b/Client/WriteApiAsync.cs
index b64249c0f..bd926637b 100644
--- a/Client/WriteApiAsync.cs
+++ b/Client/WriteApiAsync.cs
@@ -411,7 +411,8 @@ private Task WriteData(string org, string bucket, WritePrecision precision, IEnu
var sb = ToLineProtocolBody(data);
if (sb.Length == 0)
{
- Trace.WriteLine($"The writes: {data} doesn't contains any Line Protocol, skipping");
+ Trace.WriteLine($"The writes: {data} doesn't contains any Line Protocol, skipping",
+ InfluxDBTraceFilter.CategoryInfluxWrite);
return Task.CompletedTask;
}
diff --git a/Client/Writes/Events.cs b/Client/Writes/Events.cs
index 3124a2b12..14ae98db8 100644
--- a/Client/Writes/Events.cs
+++ b/Client/Writes/Events.cs
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using InfluxDB.Client.Api.Domain;
+using InfluxDB.Client.Core;
namespace InfluxDB.Client.Writes
{
@@ -18,7 +19,8 @@ public WriteSuccessEvent(string organization, string bucket, WritePrecision prec
internal override void LogEvent()
{
- Trace.WriteLine("The data was successfully written to InfluxDB 2.");
+ Trace.WriteLine("The data was successfully written to InfluxDB 2.",
+ InfluxDBTraceFilter.CategoryInfluxWrite);
}
}
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy