-
Notifications
You must be signed in to change notification settings - Fork 96
feat: #560 disable console log #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
57ad5c9
feat: CategoryTraceFilter
Sciator a0e70d9
refactor:move CategoryTraceFilter to InfluxDB.core
Sciator 45374c5
feat: Trace marked as CategoryInflux
Sciator 3c45895
feat: SuppressInflux method
Sciator 9074db8
docs: Filter trace verbose
Sciator dd7fb79
docs: CHANGELOG
Sciator 3e235fe
Merge remote-tracking branch 'origin/master' into 560-disable-console…
Sciator 6e2ddf1
style: indenting
Sciator 0a49f80
feat: trace categories error, query, write
Sciator 34c1ee6
refactor: rename InfluxDBTraceFilter, docs
Sciator 6343308
refactor: rename InfluxDBTraceFilter
Sciator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System.Diagnostics; | ||
using System.Linq; | ||
|
||
namespace InfluxDB.Client.Core | ||
{ | ||
/// <summary> | ||
/// The <see cref="InfluxDBTraceFilter"/> is used to filter client trace messages by category. | ||
/// </summary> | ||
public class InfluxDBTraceFilter : TraceFilter | ||
{ | ||
public const string CategoryInflux = "influx-client"; | ||
public const string CategoryInfluxError = "influx-client-error"; | ||
public const string CategoryInfluxQuery = "influx-client-query"; | ||
public const string CategoryInfluxQueryError = "influx-client-query-error"; | ||
public const string CategoryInfluxWrite = "influx-client-write"; | ||
public const string CategoryInfluxWriteError = "influx-client-write-error"; | ||
public const string CategoryInfluxLogger = "influx-client-logger"; | ||
|
||
private readonly string[] _categoryToFilter; | ||
private readonly bool _keep; | ||
|
||
public InfluxDBTraceFilter(string[] categoryToFilter, bool keep) | ||
{ | ||
_categoryToFilter = categoryToFilter; | ||
_keep = keep; | ||
} | ||
|
||
public override bool ShouldTrace(TraceEventCache eventCache, string source, TraceEventType eventType, int id, | ||
string formatOrMessage, object[] args, object data, object[] dataArray) | ||
{ | ||
return _categoryToFilter.Any(x => x == source) ^ _keep; | ||
} | ||
|
||
/// <summary> | ||
/// Suppress all client trace messages. | ||
/// </summary> | ||
/// <returns>Trace Filter</returns> | ||
public static InfluxDBTraceFilter SuppressInflux() | ||
{ | ||
return new InfluxDBTraceFilter(new string[] | ||
{ | ||
CategoryInflux, | ||
CategoryInfluxError, | ||
CategoryInfluxQuery, | ||
CategoryInfluxQueryError, | ||
CategoryInfluxWrite, | ||
CategoryInfluxWriteError, | ||
CategoryInfluxLogger | ||
}, false); | ||
} | ||
|
||
/// <summary> | ||
/// Suppress all client trace messages except <see cref="CategoryInfluxError"/>, <see cref="CategoryInfluxQueryError"/>, <see cref="CategoryInfluxWriteError"/>. | ||
/// </summary> | ||
/// <returns>Trace Filter</returns> | ||
public static InfluxDBTraceFilter SuppressInfluxVerbose() | ||
{ | ||
return new InfluxDBTraceFilter(new string[] | ||
{ | ||
CategoryInflux, | ||
CategoryInfluxQuery, | ||
CategoryInfluxWrite, | ||
CategoryInfluxLogger | ||
}, false); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.