Программирование в IIS

гептрал цена в красноярске

Пример 3.9

/// <summary> /// logs messages to event log /// in: string that contains message of error /// or information that ought to be logged /// /// out: returns true if successful write, /// rethrows the error if failure occurs /// </summary> /// [WebMethod] public bool LogMessage(string Message, bool Error) { System.Diagnostics.EventLogEntryType MessageType;

try { //determine the type of message if (Error ) { MessageType = System.Diagnostics.EventLogEntryType.Error; } else { MessageType = System.Diagnostics.EventLogEntryType.Information; }

//make the write this.Log.WriteEntry(Message, MessageType); } catch (System.Exception eLogWrite) { //nothing else left to do except throw the raw error throw eLogWrite; } //we have success if we get to this line return true; }

Листинг 3.9. LogMessage Function of the Events Class

Закрыть окно

Содержание  Назад  Вперед