Centreon_EventLog_2_Syslog.SyslogServer.PrepareSyslogEvent C# (CSharp) Method

PrepareSyslogEvent() private method

Transform EventLogEntry to String
private PrepareSyslogEvent ( String evebntLogName, System.Diagnostics.EventLogEntry eventLogEntry ) : String
evebntLogName String EventLog name
eventLogEntry System.Diagnostics.EventLogEntry Event to transfert to syslog server
return String
        private String PrepareSyslogEvent(String evebntLogName, EventLogEntry eventLogEntry)
        {
            // Prepare message will sent to syslog server
            String body = eventLogEntry.Source.Replace(" ", "_") + " Type: " + eventLogEntry.EntryType.ToString();

            if (eventLogEntry.Category != null)
                body = body + ", Category: " + eventLogEntry.Category;

            if (eventLogEntry.EventID != 0)
                body = body + ", Event ID: " + eventLogEntry.EventID;

            if (eventLogEntry.UserName != null)
                body = body + ", User: " + eventLogEntry.UserName;

            body = body + ", Description: " + eventLogEntry.Message;

            body = body.Replace('\r', ' ');
            body = body.Replace('\n', ' ');

            return body;
        }