mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 05:23:31 -07:00
added loggly integration
This commit is contained in:
parent
0e7ca07e02
commit
3010ed6073
7 changed files with 211 additions and 1 deletions
40
NzbDrone.Common/Instrumentation/LogEventExtensions.cs
Normal file
40
NzbDrone.Common/Instrumentation/LogEventExtensions.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
||||
namespace NzbDrone.Common.Instrumentation
|
||||
{
|
||||
public static class LogEventExtensions
|
||||
{
|
||||
public static string GetHash(this LogEventInfo logEvent)
|
||||
{
|
||||
var stackString = Json.Serialize(logEvent.StackTrace);
|
||||
var hashSeed = String.Concat(logEvent.LoggerName, logEvent.Exception.GetType().ToString(), stackString, logEvent.Level);
|
||||
return HashUtil.CalculateCrc(hashSeed);
|
||||
}
|
||||
|
||||
|
||||
public static string GetFormattedMessage(this LogEventInfo logEvent)
|
||||
{
|
||||
var message = logEvent.FormattedMessage;
|
||||
|
||||
if (logEvent.Exception != null)
|
||||
{
|
||||
if (logEvent.Exception != null)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
message = logEvent.Exception.Message;
|
||||
}
|
||||
else
|
||||
{
|
||||
message += ": " + logEvent.Exception.Message;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue