forked from banmohan/sales
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExceptionLogger.cs
34 lines (31 loc) · 951 Bytes
/
ExceptionLogger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Net;
using Frapid.Framework;
using Newtonsoft.Json;
using Serilog;
namespace MixERP.Sales
{
public sealed class ExceptionLogger : IExceptionLogger
{
public void LogError()
{
try
{
using (var client = new WebClient())
{
string json = JsonConvert.SerializeObject(this);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
client.UploadString("http://exceptions.mixerp.net", "POST", json);
}
}
catch
{
Log.Error("Could not log exception to MixERP API endpoint.");
}
}
public string Tenant { get; set; }
public string OfficeName { get; set; }
public int UserId { get; set; }
public string UserName { get; set; }
public string Message { get; set; }
}
}