Esempio n. 1
0
        /// <summary>
        /// Creates a logger with specified parameters
        /// </summary>
        /// <param name="category">Logger category</param>
        /// <param name="logCallStack">True to log call stack</param>
        /// <param name="type">Type of the logger</param>
        /// <returns>New logger instance</returns>
        public static ILogger Create(string category   = "SwEx", bool logCallStack = false,
                                     LoggerType_e type = LoggerType_e.Trace)
        {
            switch (type)
            {
            case LoggerType_e.Trace:
                return(new TraceLogger(category, logCallStack));

            default:
                throw new NotSupportedException($"{type} logger is not supported");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Specifies the logger type and option to log call stack
 /// </summary>
 /// <param name="logCallStack">True to include call stack into the exception log message</param>
 /// <param name="name">Name of the logger</param>
 /// <param name="type">Type of logger</param>
 public LoggerOptionsAttribute(bool logCallStack, string name = "", LoggerType_e type = LoggerType_e.Trace)
 {
     Type         = type;
     LogCallStack = logCallStack;
     Name         = name;
 }