Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enterprise 6.0 Logging
using System.Diagnostics;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;
namespace LogBlock
{
class Program
{
public void FlatText()
{
var textWriter = new TextWriterTraceListener("test.txt");
textWriter.WriteLine("Enterprise 6.0 Log");
textWriter.Close();
}
public void Logging()
{
var config = new LoggingConfiguration();
var flatTextFormatter = new FlatFileTraceListener("flatfilelog.txt", "--start here--", "--end here--");
config.AddLogSource("Level1", SourceLevels.All, true, flatTextFormatter);
var writer = new LogWriter(config);
writer.Write("Test");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment