Ejemplo n.º 1
0
        /// <summary>
        /// Responsible for converting exceptions into <seealso cref="IExceptionEntry"/> object,
        /// gets the entry empty object and passes to <seealso cref="FormatException(System.Exception, Tavisca.Frameworks.Logging.IExceptionEntry)"/>
        /// The method calls <seealso cref="FormatException(Tavisca.Frameworks.Logging.IExceptionEntry)"/> at the end for
        /// final formatting, override this method only to change how an exception is converted to an entry.
        /// </summary>
        /// <param name="exception">The exception entry to be converted.</param>
        /// <returns>An <see cref="IExceptionEntry"/> object.</returns>
        public virtual IExceptionEntry FormatException(Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }

            var entry = LocatorProvider.GetContainer().GetInstance <IExceptionEntry>();

            if (entry == null)
            {
                throw new LogConfigurationException("IExceptionEntry is not configured in the DI container.");
            }

            entry = FormatException(exception, entry);

            return(FormatException(entry));
        }
Ejemplo n.º 2
0
 protected virtual ILogEntry GetLogEntry()
 {
     return(LocatorProvider.GetContainer().GetInstance <ITransactionEntry>());
 }
Ejemplo n.º 3
0
 protected virtual ITraceLogger GetTraceLogFactory()
 {
     return(LocatorProvider.GetContainer().GetInstance <ITraceLogger>());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets an <see cref="ISink"/> by name using the DI container configured in the system.
 /// </summary>
 /// <param name="name">The name (key) of the logger.</param>
 /// <returns>An instance of an <see cref="ISink"/></returns>
 protected virtual ISink GetLoggerByName(string name)
 {
     return(LocatorProvider.GetContainer().GetInstance <ISink>(name));
 }
Ejemplo n.º 5
0
 protected virtual IExceptionEntry GetEmptyExceptionEntry()
 {
     return(LocatorProvider.GetContainer().GetInstance <IExceptionEntry>());
 }
Ejemplo n.º 6
0
 protected virtual IEntryStringTranslator GetTranslator()
 {
     return(LocatorProvider.GetContainer().GetInstance <IEntryStringTranslator>());
 }