Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
#1 reduce log level to trace where required to condense logs
Browse files Browse the repository at this point in the history
  • Loading branch information
alhardy committed Feb 10, 2017
1 parent 37cdd95 commit 97ccbb7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 29 deletions.
14 changes: 7 additions & 7 deletions src/App.Metrics.Extensions.Reporting.Console/ConsoleReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public ConsoleReporter(string name, TimeSpan reportInterval, ILoggerFactory logg

public TimeSpan ReportInterval { get; }

public void Dispose() { _logger.LogDebug("Console Reporter Disposed"); }
public void Dispose() { }

public Task<bool> EndAndFlushReportRunAsync(IMetrics metrics)
{
_logger.LogDebug("Ending Console Report Run");
_logger.LogTrace("Ending Console Report Run");

WriteLine(
string.Format(
Expand Down Expand Up @@ -80,7 +80,7 @@ public void ReportHealth(
IEnumerable<HealthCheck.Result> unhealthyChecks)
{
WriteLine(typeof(HealthStatus).HumanzeStartMetricType());
_logger.LogDebug("Writing Health Checks for Console");
_logger.LogTrace("Writing Health Checks for Console");

var passed = healthyChecks.ToList();
var failed = unhealthyChecks.ToList();
Expand Down Expand Up @@ -114,24 +114,24 @@ public void ReportHealth(

failed.ForEach(c => WriteLine(c.Hummanize()));

_logger.LogDebug("Writing Health Checks for Console");
_logger.LogTrace("Writing Health Checks for Console");
WriteLine(typeof(HealthStatus).HumanzeEndMetricType());
}

public void ReportMetric<T>(string context, MetricValueSourceBase<T> valueSource)
{
_logger.LogDebug("Writing Metric {T} for Console", typeof(T));
_logger.LogTrace("Writing Metric {T} for Console", typeof(T));

WriteLine(valueSource.HumanzizeName(context));

WriteLine(valueSource.Hummanize());

_logger.LogDebug("Writing Metric {T} for Console", typeof(T));
_logger.LogTrace("Writing Metric {T} for Console", typeof(T));
}

public void StartReportRun(IMetrics metrics)
{
_logger.LogDebug("Starting Console Report Run");
_logger.LogTrace("Starting Console Report Run");

WriteLine(
string.Format(
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Reporting.Console/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
}
},
"title": "App.Metrics.Extensions.Reporting.Console",
"version": "1.0.0-beta5"
"version": "1.0.0-rc1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<LineProtocolWriteResult> WriteAsync(
return new LineProtocolWriteResult(false, result.FinalException.ToString());
}

_logger.LogDebug("Successful write to InfluxDB");
_logger.LogTrace("Successful write to InfluxDB");

return result.Result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public InfluxDbReporter(
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

public void Dispose(bool disposing)
Expand All @@ -81,14 +80,12 @@ public void Dispose(bool disposing)
}
}

_logger.LogDebug($"{Name} Disposed");

_disposed = true;
}

public async Task<bool> EndAndFlushReportRunAsync(IMetrics metrics)
{
_logger.LogDebug($"Ending {Name} Run");
_logger.LogTrace($"Ending {Name} Run");

var result = await _lineProtocolClient.WriteAsync(_payloadBuilder.Payload());

Expand All @@ -105,7 +102,7 @@ public void ReportHealth(
IEnumerable<HealthCheck.Result> degradedChecks,
IEnumerable<HealthCheck.Result> unhealthyChecks)
{
_logger.LogDebug($"Packing Health Checks for {Name}");
_logger.LogTrace($"Packing Health Checks for {Name}");

var unhealthy = unhealthyChecks as HealthCheck.Result[] ?? unhealthyChecks.ToArray();
var degraded = degradedChecks as HealthCheck.Result[] ?? degradedChecks.ToArray();
Expand Down Expand Up @@ -147,12 +144,12 @@ public void ReportHealth(
}
}

_logger.LogDebug($"Packed Health Checks for {Name}");
_logger.LogTrace($"Packed Health Checks for {Name}");
}

public void ReportMetric<T>(string context, MetricValueSourceBase<T> valueSource)
{
_logger.LogDebug($"Packing Metric {typeof(T)} for {Name}");
_logger.LogTrace($"Packing Metric {typeof(T)} for {Name}");

if (typeof(T) == typeof(double))
{
Expand Down Expand Up @@ -190,12 +187,12 @@ public void ReportMetric<T>(string context, MetricValueSourceBase<T> valueSource
return;
}

_logger.LogDebug($"Finished Packing Metric {typeof(T)} for {Name}");
_logger.LogTrace($"Finished Packing Metric {typeof(T)} for {Name}");
}

public void StartReportRun(IMetrics metrics)
{
_logger.LogDebug($"Starting {Name} Report Run");
_logger.LogTrace($"Starting {Name} Report Run");

_payloadBuilder.Init();
}
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Reporting.InfluxDB/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
}
},
"title": "App.Metrics.Extensions.Reporting.InfluxDB",
"version": "1.0.0-beta5-2"
"version": "1.0.0-rc1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public class TextFileReporter : IMetricReporter
private bool _disposed;

public TextFileReporter(string file, TimeSpan interval, ILoggerFactory loggerFactory)
: this(typeof(TextFileReporter).Name, file, interval, loggerFactory) { }
: this(typeof(TextFileReporter).Name, file, interval, loggerFactory)
{
}

public TextFileReporter(string name, string file, TimeSpan interval, ILoggerFactory loggerFactory)
{
Expand Down Expand Up @@ -71,16 +73,14 @@ public void Dispose(bool disposing)
}
}

_logger.LogDebug($"{Name} Disposed");

_disposed = true;
}

public async Task<bool> EndAndFlushReportRunAsync(IMetrics metrics)
{
await _stringReporter.EndAndFlushReportRunAsync(metrics);

_logger.LogDebug($"End {Name} Run");
_logger.LogTrace($"End {Name} Run");

var file = new FileInfo(_file);
file.Directory.Create();
Expand All @@ -97,25 +97,25 @@ public void ReportHealth(
IEnumerable<HealthCheck.Result> degradedChecks,
IEnumerable<HealthCheck.Result> unhealthyChecks)
{
_logger.LogDebug($"Writing Health Checks for {Name}");
_logger.LogTrace($"Writing Health Checks for {Name}");

_stringReporter.ReportHealth(globalMetrics, healthyChecks, degradedChecks, unhealthyChecks);

_logger.LogDebug($"Writing Health Checks for {Name}");
_logger.LogTrace($"Writing Health Checks for {Name}");
}

public void ReportMetric<T>(string context, MetricValueSourceBase<T> valueSource)
{
_logger.LogDebug($"Start Writing Metric {typeof(T)} for {Name}");
_logger.LogTrace($"Start Writing Metric {typeof(T)} for {Name}");

_stringReporter.ReportMetric(context, valueSource);

_logger.LogDebug($"End Writing Metric {typeof(T)} for {Name}");
_logger.LogTrace($"End Writing Metric {typeof(T)} for {Name}");
}

public void StartReportRun(IMetrics metrics)
{
_logger.LogDebug($"Starting {Name} Run");
_logger.LogTrace($"Starting {Name} Run");

_stringReporter.StartReportRun(metrics);
}
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Reporting.TextFile/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
}
},
"title": "App.Metrics.Extensions.Reporting.TextFile",
"version": "1.0.0-beta5"
"version": "1.0.0-rc1"
}

0 comments on commit 97ccbb7

Please sign in to comment.