init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
Framework/Logging
71
Framework/Logging/LogWriterBase.cs
Normal file
71
Framework/Logging/LogWriterBase.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
|
||||
namespace Kreta.Framework.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// A naplóvezetők absztrakt ősosztálya.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Az ősosztály felelőssége a naplózás során történt kivételek egységes kezelése, így azzal a
|
||||
/// leszármazott osztályoknak nem kell foglalkozniuk.
|
||||
/// </remarks>
|
||||
public abstract class LogWriterBase : ILogWriter
|
||||
{
|
||||
/// <summary>
|
||||
/// Fizikailag a naplóba ír egy üzenetet.
|
||||
/// </summary>
|
||||
/// <param name="message">A naplóba vezetendő üzenet</param>
|
||||
protected abstract Guid? DoLog(ILogMessage message);
|
||||
|
||||
/// <summary>
|
||||
/// Does the log.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="logId">The log identifier.</param>
|
||||
/// <returns></returns>
|
||||
protected abstract void DoLog(ILogMessage message, Guid logId);
|
||||
|
||||
/// <summary>
|
||||
/// Naplóba ír egy naplóbejegyzést.
|
||||
/// </summary>
|
||||
/// <param name="message">A naplóbejegyzés</param>
|
||||
public Guid? Log(ILogMessage message)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DoLog(message);
|
||||
}
|
||||
catch (LogWriterException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new LogWriterException(message, string.Format("Failure writing log in class {0}.", GetType().FullName), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the specified message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="logId">The log identifier.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="LogWriterException"></exception>
|
||||
public void Log(ILogMessage message, Guid logId)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoLog(message, logId);
|
||||
}
|
||||
catch (LogWriterException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new LogWriterException(message, string.Format("Failure writing log in class {0}.", GetType().FullName), exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue