mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-05-28 09:41:50 +02:00
Added SMBServer.OnLogEntry event
Implementers can now subscribe to the OnLogEntry event and receive log entries.
This commit is contained in:
parent
08717b5358
commit
74e92f2e2b
14 changed files with 147 additions and 44 deletions
|
@ -90,6 +90,7 @@ namespace SMBServer
|
|||
}
|
||||
|
||||
m_server = new SMBLibrary.Server.SMBServer(shares, provider, serverAddress, transportType);
|
||||
m_server.OnLogEntry += new EventHandler<LogEntry>(Server_OnLogEntry);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -214,5 +215,12 @@ namespace SMBServer
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void Server_OnLogEntry(object sender, LogEntry entry)
|
||||
{
|
||||
string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ");
|
||||
string message = String.Format("{0} {1} {2}", entry.Severity.ToString().PadRight(12), timestamp, entry.Message);
|
||||
System.Diagnostics.Debug.Print(message);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue