diff --git a/UlUtil.cs b/UlUtil.cs index 1eebe5c..2ad0b3d 100644 --- a/UlUtil.cs +++ b/UlUtil.cs @@ -8,16 +8,34 @@ namespace upper_limit_crawler { public static class UlUtil { + static string m_strLogServer = "mjjo53.us.to:8000"; + static CPUTILLib.CpCybos m_Util = new CPUTILLib.CpCybos(); + public static string GetCurTimeString() { 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) { - Console.WriteLine("["+GetCurTimeString() + "] " + strMsg); + string strLog = "["+GetCurTimeString()+"] "+strMsg; + Console.WriteLine(strLog); + WebLog(m_strLogServer, strLog); } public static int GetLimitRemainCountTrace() @@ -34,24 +52,5 @@ namespace upper_limit_crawler { 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); - // //} - //} } }