Salvataggio log con le funzioni di System.Diagnostic.
/* Gestione log in debug */
string percorsoSalvataggio = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + "PAI-PL_PCCS_Client\\Log\\";
if (!Directory.Exists(percorsoSalvataggio))
{
Directory.CreateDirectory(percorsoSalvataggio);
}
if (m_LogStreamFile == null)
{
try
{
m_LogStreamFile = new FileStream(percorsoSalvataggio + DateTime.Now.ToString("yyyyMMddHHmmss") + "_LogFile.txt", FileMode.Append);
// Add the stream object to the trace listeners.
TextWriterTraceListener m_LogListener = new TextWriterTraceListener(m_LogStreamFile);
Debug.Listeners.Add(m_LogListener);
m_timerFlush = new System.Timers.Timer(10000);
m_timerFlush.Start();
m_timerFlush.Elapsed += TimerFlush_Elapsed;
}
catch (Exception)
{
}
}