コード例 #1
0
 private async void SendRequest(LogRequest request)
 {
     try
     {
         string stringifiedPayload = JsonConvert.SerializeObject(request);
         var    httpRequest        = new HttpRequestMessage
         {
             Content = new StringContent(stringifiedPayload, Encoding.UTF8, "application/json"),
             Headers =
             {
                 { "clientId", loggerSettings.ClientId }
             },
             RequestUri = new Uri(loggerSettings.Url),
             Method     = HttpMethod.Post
         };
         var response = await http.SendAsync(httpRequest);
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e);
     }
 }
コード例 #2
0
        public void Info(string message)
        {
            LogRequest payload = new LogRequest(message, LogLevel.Info);

            SendRequest(payload);
        }
コード例 #3
0
        public void Error(string message, object json)
        {
            LogRequest payload = new LogRequest(message, json, LogLevel.Error);

            SendRequest(payload);
        }
コード例 #4
0
        public void Info(string message, object json)
        {
            LogRequest payload = new LogRequest(message, json, LogLevel.Info);

            SendRequest(payload);
        }