using System.Diagnostics; public void Log(string message) { EventLog.WriteEntry("Application", message, EventLogEntryType.Information); }
using System.Diagnostics; using System.IO; public void Log(string message) { string filePath = @"C:\Logs\WorkflowLog.txt"; using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine(DateTime.Now.ToString() + " - " + message); } }This code snippet demonstrates another use case for the ILog Activity, by writing a log message to a text file. The `Log()` method creates an instance of the `StreamWriter` class, passing the file path and a flag to append to the existing file if it exists. Then, it writes the current date and time, and the message text to the file. The ILog Activity is part of the System.Activities.Statements namespace in the System.Activities assembly, which is included with the .NET Framework.