removed logconfiguration

This commit is contained in:
kay.one 2013-02-27 22:59:08 -08:00
parent 2fae57dbea
commit 651c7c095a
23 changed files with 2762 additions and 245 deletions

View file

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Exceptron.Client;
using Exceptron.Client.Configuration;
using NLog;
using NzbDrone.Common.Contract;
@ -16,7 +14,6 @@ namespace NzbDrone.Common
private const string PARSE_URL = SERVICE_URL + "/ParseError";
public static RestProvider RestProvider { get; set; }
public static ExceptronClient ExceptronClient { get; set; }
private static readonly HashSet<string> parserErrorCache = new HashSet<string>();
@ -57,68 +54,6 @@ namespace NzbDrone.Common
}
}
public static string ReportException(LogEventInfo logEvent)
{
try
{
VerifyDependencies();
var exceptionData = new ExceptionData();
exceptionData.Exception = logEvent.Exception;
exceptionData.Component = logEvent.LoggerName;
exceptionData.Message = logEvent.FormattedMessage;
exceptionData.UserId = EnvironmentProvider.UGuid.ToString().Replace("-", string.Empty);
if (logEvent.Level <= LogLevel.Info)
{
exceptionData.Severity = ExceptionSeverity.None;
}
else if (logEvent.Level <= LogLevel.Warn)
{
exceptionData.Severity = ExceptionSeverity.Warning;
}
else if (logEvent.Level <= LogLevel.Error)
{
exceptionData.Severity = ExceptionSeverity.Error;
}
else if (logEvent.Level <= LogLevel.Fatal)
{
exceptionData.Severity = ExceptionSeverity.Fatal;
}
return ExceptronClient.SubmitException(exceptionData).RefId;
}
catch (Exception e)
{
if (!EnvironmentProvider.IsProduction)
{
throw;
}
if (logEvent.LoggerName != logger.Name)//prevents a recursive loop.
{
logger.WarnException("Unable to report exception. ", e);
}
}
return null;
}
public static void SetupExceptronDriver()
{
var config = new ExceptronConfiguration
{
ApiKey = "CB230C312E5C4FF38B4FB9644B05E60G",
ThrowExceptions = !EnvironmentProvider.IsProduction,
};
ExceptronClient = new ExceptronClient(config)
{
ApplicationVersion = new EnvironmentProvider().Version.ToString()
};
}
private static void VerifyDependencies()
{
if (RestProvider == null)
@ -133,19 +68,6 @@ namespace NzbDrone.Common
throw new InvalidOperationException("REST Provider wasn't configured correctly.");
}
}
if (ExceptronClient == null)
{
if (EnvironmentProvider.IsProduction)
{
logger.Warn("Exceptron Driver wasn't provided. creating new one!");
SetupExceptronDriver();
}
else
{
throw new InvalidOperationException("Exceptron Driver wasn't configured correctly.");
}
}
}
}
}