Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //
            // TODO: 在此处添加代码以启动应用程序
            //
            var log       = "TestLog001";
            var source    = "TestSource001";
            var eventLogs = EventLog.GetEventLogs();

            Array.ForEach
            (
                eventLogs
                , (x) =>
            {
                Console.WriteLine
                (
                    "Source: {1}{0}Log: {2}"
                    , "\t"
                    , x.Source
                    , x.Log
                );
            }
            );
            EventLogHelper.TryCreateEventSourceLog(log, source);
            EventLogHelper.WriteEventLogEntry
            (
                source
                , "TestMessage"
                , EventLogEntryType.Information
                , 1000
            );
            Console.WriteLine("Hello World");
            Console.WriteLine(Environment.Version.ToString());
        }