예제 #1
0
        static void Main(string[] args)
        {
            using (ChannelFactory <IEventLog> channelFactory1 = new ChannelFactory <IEventLog>("eventLogService"))
            {
                IEventLog         proxy        = channelFactory1.CreateChannel();
                string            source       = "...<<source>>...";
                string            message      = "...<<message>>...";
                EventLogEntryType logEntryType = EventLogEntryType.Error;
                int   eventId  = 123;
                short category = 456;
                proxy.WriteEntry(source, message, logEntryType, eventId, category);
            }

            using (ChannelFactory <IInstrumentation> channelFactory2 = new ChannelFactory <IInstrumentation>("instrumentationservice"))
            {
                IInstrumentation proxy = channelFactory2.CreateChannel();
                string           performanceCounterCategory = "...<<category>>...";
                string           performanceCounterName     = "...<<performance name>>...";
                string           wmiPropertyName            = "...<<WMI Properpty Name>>...";
                string           wmiPropertyValye           = "...<<>WMI Property Value>...";
                proxy.IncreasePerformanceCounter(performanceCounterCategory, performanceCounterName);
                proxy.SetWmiProperty(wmiPropertyName, wmiPropertyValye);
            }
            Console.Read();
        }
예제 #2
0
 public static void WriteEntry(this IEventLog eventLog, string message, EventLogEntryType type, int eventId, short category)
 {
     eventLog.WriteEntry(message, type, eventId, category, (byte[])null);
 }
예제 #3
0
 public static void WriteEntry(this IEventLog eventLog, string message, EventLogEntryType type)
 {
     eventLog.WriteEntry(message, type, 0, (short)0, (byte[])null);
 }