using System; namespace Kreta.Framework.Logging { /// /// A naplóvezetők absztrakt ősosztálya. /// /// /// 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. /// public abstract class LogWriterBase : ILogWriter { /// /// Fizikailag a naplóba ír egy üzenetet. /// /// A naplóba vezetendő üzenet protected abstract Guid? DoLog(ILogMessage message); /// /// Does the log. /// /// The message. /// The log identifier. /// protected abstract void DoLog(ILogMessage message, Guid logId); /// /// Naplóba ír egy naplóbejegyzést. /// /// A naplóbejegyzés 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); } } /// /// Logs the specified message. /// /// The message. /// The log identifier. /// /// 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); } } } }