using System.Data;
using System.Drawing;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.IO;
+using log4net;
namespace AppLimit.NetSparkle
{
public partial class NetSparkleMainWindows : Form, IDisposable
{
- private StreamWriter sw = null;
+ private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public NetSparkleMainWindows()
{
// init ui
InitializeComponent();
- // init logfile
- sw = File.CreateText(Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "NetSparkle.log"));
}
public void Report(String message)
{
try
{
- // write
- sw.WriteLine(msg);
-
- // flush
- sw.Flush();
+ Log.Info(msg);
} catch(Exception)
{
void IDisposable.Dispose()
{
- // flush again
- sw.Flush();
-
- // close the stream
- sw.Dispose();
// close the base
base.Dispose();