/// <summary> /// Schreibt die Nachricht ins Log /// </summary> public void WriteMessage(string cLogMessage, MESSAGE_TYPE eTyp) { FileStream oFileStream = null; StackFrame oStackFrame; try { lock (m_oLockFileWrite) { oStackFrame = new StackTrace().GetFrame(1); // Datei öffnen, gegebenenfalls erstellen if (!File.Exists(CURRENT_LOG_FILE)) { oFileStream = File.Create(CURRENT_LOG_FILE); oFileStream.Close(); oFileStream.Dispose(); } using (StreamWriter oLogWriter = new StreamWriter(CURRENT_LOG_FILE, true, Encoding.UTF8)) { oLogWriter.WriteLine(string.Format( "[{0:T}] => {1} <{2}>.<{3}>: {4}", DateTime.Now, eTyp.ToString().ToUpper(), oStackFrame.GetMethod().ReflectedType.Name, oStackFrame.GetMethod().Name, cLogMessage )); oLogWriter.Close(); } } } catch (Exception oEx) { throw oEx; } finally { if (oFileStream != null) { oFileStream.Close(); oFileStream.Dispose(); } } }
public override string ToString() { // e.g. {REQUEST_PORT, “SVC1”, 0, SUCCESS} string result = ""; result += "{"; result += msg_type.ToString(); result += ", "; result += service_name; result += ", "; result += port.ToString(); result += ", "; result += status.ToString(); result += "}"; return(result); }
public override void ADD_MESSAGE_LOG( String _Message_Text , MESSAGE_TYPE _Messaage_Type , MESSAGE_RESULT_TYPE _Message_Result_Type = MESSAGE_RESULT_TYPE.Succeed) { List <SqlParameter> sqlParaList = new List <SqlParameter>(); SqlParameter message_type = new SqlParameter("@message_type", SqlDbType.NVarChar); message_type.Value = _Messaage_Type.ToString(); sqlParaList.Add(message_type); SqlParameter message_result = new SqlParameter("@message_result", SqlDbType.NVarChar); message_result.Value = _Message_Result_Type.ToString(); sqlParaList.Add(message_result); SqlParameter message_description = new SqlParameter("@message_description", SqlDbType.NVarChar); message_description.Value = _Message_Text; sqlParaList.Add(message_description); SqlParameter[] parameters = sqlParaList.ToArray(); EXECUTE_PROCEDURE_WITH_PARAMETERS(this, "sp_ssas_automation_deploy_log_details", parameters); }
public void givePlayerFeedBack(Heros currentHero, String text, MESSAGE_TYPE messageType) { Console.WriteLine(text); displayInfo(Program.DebugMode, text, messageType.ToString()); }
void LogAPIStatus(MESSAGE_TYPE type, string msg) { OnActionExecuted(new ActionEventArgs("OnTAPIStatus", type.ToString(), msg)); }
private void OnTAPIStatus(object sender, MESSAGE_TYPE status, string msg) { if (String.IsNullOrEmpty(msg)) { msg = ""; } else { msg = msg.Trim(); } switch (status) { case MESSAGE_TYPE.MT_CONNECT_READY: // 連線成功 SetConnectionStatus(ConnectionStatus.CONNECTED); break; case MESSAGE_TYPE.MT_CONNECT_FAIL: // 連線錯誤 break; case MESSAGE_TYPE.MT_DISCONNECTED: // 已斷線 SetConnectionStatus(ConnectionStatus.DISCONNECTED); break; case MESSAGE_TYPE.MT_SUBSCRIBE: // 訂閱 break; case MESSAGE_TYPE.MT_UNSUBSCRIBE: // 解除訂閱 break; case MESSAGE_TYPE.MT_HEART_BEAT: break; case MESSAGE_TYPE.MT_LOGIN_OK: // 登入成功 _tradeLoginOK = true; break; case MESSAGE_TYPE.MT_LOGIN_FAIL: // 登入失敗 _tradeLoginOK = false; break; case MESSAGE_TYPE.MT_ERROR: break; case MESSAGE_TYPE.MT_RETRIEVE_FUT_DONE: break; case MESSAGE_TYPE.MT_RETRIEVE_OPT_DONE: break; case MESSAGE_TYPE.MT_RETRIEVE_STK_DONE: break; default: break; } OnActionExecuted(new ActionEventArgs("OnTAPIStatus", status.ToString(), msg)); }
public void MessageLog(string message, MESSAGE_TYPE type) { rtbLog.AppendText(string.Format("[{0}] | [{1}] - {2}\n", System.DateTime.Now.ToString("hh:mm:ss"), type.ToString(), message)); }
/// <summary> /// Schreibt die Nachricht ins Log /// </summary> public void WriteMessage(string cLogMessage, MESSAGE_TYPE eTyp) { FileStream oFileStream = null; StackFrame oStackFrame; try { lock (m_oLockFileWrite) { oStackFrame = new StackTrace().GetFrame(1); // Datei öffnen, gegebenenfalls erstellen if(!File.Exists(CURRENT_LOG_FILE)) { oFileStream = File.Create(CURRENT_LOG_FILE); oFileStream.Close(); oFileStream.Dispose(); } using(StreamWriter oLogWriter = new StreamWriter(CURRENT_LOG_FILE, true, Encoding.UTF8)) { oLogWriter.WriteLine(string.Format( "[{0:T}] => {1} <{2}>.<{3}>: {4}", DateTime.Now, eTyp.ToString().ToUpper(), oStackFrame.GetMethod().ReflectedType.Name, oStackFrame.GetMethod().Name, cLogMessage )); oLogWriter.Close(); } } } catch (Exception oEx) { throw oEx; } finally { if (oFileStream != null) { oFileStream.Close(); oFileStream.Dispose(); } } }