You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
65 lines
1.6 KiB
1 month ago
|
|
||
|
using System;
|
||
|
using System.IO;
|
||
|
using System.Net;
|
||
|
using System.Text;
|
||
|
using System.Threading;
|
||
|
using System.Collections.Generic;
|
||
|
using Newtonsoft.Json;
|
||
|
using System.IO.Compression;
|
||
|
using System.Timers;
|
||
|
using Newtonsoft.Json.Converters;
|
||
|
using Timer = System.Timers.Timer;
|
||
|
|
||
|
using Sog;
|
||
|
using Sog.Log;
|
||
|
|
||
|
namespace ThinkingData.Analytics
|
||
|
{
|
||
|
|
||
|
/// <summary>
|
||
|
/// 我们的消费类
|
||
|
/// 这就是套个壳,让taSDK调用,文件写入调用我们自身的日志写入流
|
||
|
/// </summary>
|
||
|
public class SogConsumer : IConsumer
|
||
|
{
|
||
|
private readonly IsoDateTimeConverter _timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss.fff" };
|
||
|
private readonly MyJsonDataConverter _jsonDataConverter = new MyJsonDataConverter();
|
||
|
|
||
|
public void Send(Dictionary<string, object> message)
|
||
|
{
|
||
|
string sendingData;
|
||
|
try
|
||
|
{
|
||
|
sendingData = JsonConvert.SerializeObject(message, _timeConverter, _jsonDataConverter);
|
||
|
}
|
||
|
catch(Exception ex)
|
||
|
{
|
||
|
//TraceLog.Exception(ex);
|
||
|
throw;
|
||
|
}
|
||
|
|
||
|
if(string.IsNullOrEmpty(sendingData))
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
string event_name = null;
|
||
|
if(message.ContainsKey("#event_name"))
|
||
|
{
|
||
|
event_name = message["#event_name"] as string;
|
||
|
}
|
||
|
BillLogWriter.Instance.SendTAToBillLogSvr(0, sendingData, event_name);
|
||
|
}
|
||
|
|
||
|
public void Flush()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
public void Close()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|