here's what i've done..
using System.IO.IsolatedStorage;
using System.IO;
namespace Solution.Silverlight.Classes
{
public static class Logging
{
public static void Log(string message, LOGLEVEL logLevel)
{
try
{
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
using (Stream stream = new IsolatedStorageFileStream("Solution.Silverlight.log", FileMode.Append, FileAccess.Write, store))
{
StreamWriter writer = new StreamWriter(stream);
switch (logLevel)
{
case LOGLEVEL.INFO:
writer.Write(String.Format("{0:u} [INFO] {1}{2}", DateTime.Now, message,Environment.NewLine));
break;
case LOGLEVEL.WARNING:
writer.Write(String.Format("{0:u} [WARNING] {1}{2}", DateTime.Now, message, Environment.NewLine));
break;
case LOGLEVEL.ERROR:
writer.Write(String.Format("{0:u} [ERROR] {1}{2}", DateTime.Now, message, Environment.NewLine));
break;
case LOGLEVEL.FATAL:
writer.Write(String.Format("{0:u} [FATAL] {1}{2}", DateTime.Now, message, Environment.NewLine));
break;
default:
break;
}
writer.Close();
}
}
}
catch (Exception ex)
{
}
}
}
}
public enum LOGLEVEL
{
INFO,
WARNING,
ERROR,
FATAL
}