public void Log(Dictionary<string, string> message, Action<Communications.Result> callback)
        {
            string session = Guid.NewGuid().ToString();
            if (message.ContainsKey("SessionId"))
                session = message["SessionId"];

            var evt = new ScalyrEvent(DateTime.UtcNow);
            foreach (var pair in message.Where(kvp => !kvp.Key.Equals("SessionId")))
                evt.attrs[pair.Key] = pair.Value;

            var messageObject = new ScalyrMessage()
            {
                token = _accessToken,
                session = session
            };
            messageObject.events.Add(evt);

            string messageString = JsonSerializer.SerializeToString(messageObject);

            var request = new HttpJsonPost(messageString, null, true);
            if (_sendAsync)
                request.SendAsync(FullUrl, "POST", callback);
            else
                request.Send(FullUrl, "POST", callback);
        }
 public void Log(Dictionary<string, string> message, Action<Communications.Result> callback)
 {
     var request = new HttpJsonPost(message, useJson: false);
     if (_sendAsync)
         request.SendAsync(FullUrl, "PUT", callback, false);
     else
         request.Send(FullUrl, "PUT", callback, false);
 }
 public void Log(Dictionary<string, string> message, Action<Communications.Result> callback)
 {
     var request = new HttpJsonPost(message);
     if(_async)
         request.SendAsync(_baseUrl, "POST", callback);
     else
         request.Send(_baseUrl, "POST", callback);
 }
 public void Log(Dictionary<string, string> message, Action<Communications.Result> callback)
 {
     var credentials = new NetworkCredential("x", _accessToken, "");
     var request = new HttpJsonPost(message, credentials, true);
     if (_sendAsync)
         request.SendAsync(FullUrl, "POST", callback);
     else
         request.Send(FullUrl, "POST", callback);
 }
 private void SendMessage(IEnumerable<Metric> metrics, Action<Communications.Result> callback)
 {
     var message = GetMessages(metrics);
     var credentials = new NetworkCredential(_username, _password);
     var request = new HttpJsonPost(message, credentials, true);
     if (_sendAsync)
         request.SendAsync(FullUrl, "POST", callback);
     else
         request.Send(FullUrl, "POST", callback);
 }