Änderung
- Anzeige von Millisekunden bei der Zeitangabe in der Logzeile dazu
This commit is contained in:
parent
07a3c208d5
commit
992880be1e
Binary file not shown.
@ -163,7 +163,7 @@ namespace Eugen.ESystem.IO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the message format
|
/// Stores the message format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string messageFormat = "{0:T}: {1}";
|
private string messageFormat = "{0:T}.{1}: {2}";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region events
|
#region events
|
||||||
@ -304,6 +304,7 @@ namespace Eugen.ESystem.IO
|
|||||||
|
|
||||||
// holds the actual date and time
|
// holds the actual date and time
|
||||||
DateTime time = DateTime.Now;
|
DateTime time = DateTime.Now;
|
||||||
|
int ms = time.Millisecond;
|
||||||
|
|
||||||
// creates the file name
|
// creates the file name
|
||||||
string fileName;
|
string fileName;
|
||||||
@ -363,13 +364,12 @@ namespace Eugen.ESystem.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// build message line
|
// build message line
|
||||||
string line;
|
string line;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// creates the line
|
// creates the line
|
||||||
line = String.Format(this.messageFormat, new object[] { time, message });
|
line = String.Format(this.messageFormat, new object[] { time, ms, message });
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
@ -419,7 +419,7 @@ namespace Eugen.ESystem.IO
|
|||||||
// close file
|
// close file
|
||||||
writer.Close();
|
writer.Close();
|
||||||
|
|
||||||
OnMessageWritten(new LogWriterEventArgs(time, message));
|
OnMessageWritten(new LogWriterEventArgs(time, ms, message));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -488,6 +488,8 @@ namespace Eugen.ESystem.IO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private DateTime time;
|
private DateTime time;
|
||||||
|
|
||||||
|
private int millisecond;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the message
|
/// Stores the message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -526,10 +528,11 @@ namespace Eugen.ESystem.IO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time">Specifyes the message post time</param>
|
/// <param name="time">Specifyes the message post time</param>
|
||||||
/// <param name="message">Specifyes the message</param>
|
/// <param name="message">Specifyes the message</param>
|
||||||
public LogWriterEventArgs(DateTime time, string message)
|
public LogWriterEventArgs(DateTime time, int millisecond, string message)
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
this.time = time;
|
this.time = time;
|
||||||
|
this.millisecond = millisecond;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -134,7 +134,7 @@ namespace Test_LogWriter
|
|||||||
var logWriter1 = new LogWriter(@"C:\TMP\");
|
var logWriter1 = new LogWriter(@"C:\TMP\");
|
||||||
logWriter1.WriteMessage("Das ist ein Test");
|
logWriter1.WriteMessage("Das ist ein Test");
|
||||||
|
|
||||||
//Variante 2 - Logdateiname wird angegeben, z.B. 'my_logfile.log'
|
//Variante 2 - Logdateiname wird angegeben, z.B. 'my_logfile2.log'
|
||||||
var logWriter2 = new LogWriter(@"C:\TMP\", "my_logfile2.log");
|
var logWriter2 = new LogWriter(@"C:\TMP\", "my_logfile2.log");
|
||||||
logWriter2.WriteMessage("Das ist Test 2");
|
logWriter2.WriteMessage("Das ist Test 2");
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,8 +6,8 @@ H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWrit
|
|||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.exe.config
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.exe.config
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.exe
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.exe
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\Test_LogWriter.pdb
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.dll
|
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.pdb
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.csproj.CopyComplete
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.csproj.CopyComplete
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.exe
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.exe
|
||||||
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.pdb
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\obj\Debug\Test_LogWriter.pdb
|
||||||
|
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\LogWriter.git\Test_LogWriter\bin\Debug\helogwri.dll
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user