서버 로그 추가
This commit is contained in:
39
UlUtil.cs
39
UlUtil.cs
@@ -8,16 +8,34 @@ namespace upper_limit_crawler
|
|||||||
{
|
{
|
||||||
public static class UlUtil
|
public static class UlUtil
|
||||||
{
|
{
|
||||||
|
static string m_strLogServer = "mjjo53.us.to:8000";
|
||||||
|
|
||||||
static CPUTILLib.CpCybos m_Util = new CPUTILLib.CpCybos();
|
static CPUTILLib.CpCybos m_Util = new CPUTILLib.CpCybos();
|
||||||
|
|
||||||
|
|
||||||
public static string GetCurTimeString()
|
public static string GetCurTimeString()
|
||||||
{
|
{
|
||||||
return DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
return DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void WebLog(string strURL, string strMsg)
|
||||||
|
{
|
||||||
|
// 요청 String -> 요청 Byte 변환
|
||||||
|
byte[] byteDataParams = UTF8Encoding.UTF8.GetBytes(strMsg);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// HttpWebRequest 객체 생성, 설정
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strUri);
|
||||||
|
request.Method="POST"; // 기본값 "GET"
|
||||||
|
request.ContentType="application/x-www-form-urlencoded";
|
||||||
|
request.ContentLength=byteDataParams.Length;
|
||||||
|
}
|
||||||
|
|
||||||
public static void Trace(string strMsg)
|
public static void Trace(string strMsg)
|
||||||
{
|
{
|
||||||
Console.WriteLine("["+GetCurTimeString() + "] " + strMsg);
|
string strLog = "["+GetCurTimeString()+"] "+strMsg;
|
||||||
|
Console.WriteLine(strLog);
|
||||||
|
WebLog(m_strLogServer, strLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetLimitRemainCountTrace()
|
public static int GetLimitRemainCountTrace()
|
||||||
@@ -34,24 +52,5 @@ namespace upper_limit_crawler
|
|||||||
{
|
{
|
||||||
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_SUBSCRIBE);
|
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_SUBSCRIBE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static void WebLog(string strURL, string strMsg)
|
|
||||||
//{
|
|
||||||
// // POST
|
|
||||||
// using (var wb = new WebClient())
|
|
||||||
// {
|
|
||||||
// var data = new NameValueCollection();
|
|
||||||
// data["username"] = "myUser";
|
|
||||||
// data["password"] = "myPassword";
|
|
||||||
|
|
||||||
// var response = wb.UploadValues(strURL, "POST", data);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //// GET
|
|
||||||
// //using (var wb = new WebClient())
|
|
||||||
// //{
|
|
||||||
// // var response = wb.DownloadString(strURL);
|
|
||||||
// //}
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user