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.
 
 
 
 
 
 

51 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using Sog.Log;
using ProtoCSStruct;
namespace Chat
{
public static class ChatBillLogUtils
{
static object s_locker = new object();
public static void LogWebSysNoticeLamp(uint id, int cycleType, string triggerTime, string content)
{
BillLogHelper blh = new BillLogHelper((int)BillLogType.WebSysNoticeLamp);
blh.Append("id", id);
blh.Append("cycleType", cycleType);
blh.Append("triggerTime", triggerTime);
blh.Append("content", content);
string logMessage = blh.ToString();
lock (s_locker)
{
BillLogWriter.Instance.SendToBillLogSvr(0, logMessage);
}
}
public static void LogChatReq(long id, ref CSChatReq req)
{
string content = req.Message.GetString();
content = content.Replace('=', '*');
content = content.Replace('|', '*');
BillLogHelper blh = new BillLogHelper((int)BillLogType.ChatData);
blh.Append("uid", id);
blh.Append("target", req.TargetUid);
blh.Append("channel", (int)req.ChatChannelType);
blh.Append("message", content);
string logMessage = blh.ToString();
//BillLog底层为了效率,并不是线程安全的,聊天服务器有可能多线程处理,需要加锁 SendToBillLogSvr
lock (s_locker)
{
BillLogWriter.Instance.SendToBillLogSvr(0, logMessage);
}
}
}
}