Exemplo n.º 1
0
        public LogMessage SetContext(CallingMethodDetail detail)
        {
            if (detail == CallingMethodDetail.FullStack)
            {
                this.Set("context", StackReporter.GetCallingMethod(true, StackReporter.FullFormatStackFrame, 1));
            }
            else if (detail == CallingMethodDetail.LastMethod)
            {
                this.Set("context", StackReporter.GetCallingMethod(false, StackReporter.FullFormatStackFrame, 1));
            }

            return(this);
        }
        public static Logger CreateLogger(Type type, LoggerConfiguration loggerConfig = null)
        {
            var name = type?.FullName;

            if (name == null)
            {
                name = StackReporter.GetCallingMethod(false,
                                                      skipFrames: 1,
                                                      formatter: StackReporter.CallingTypeOnlyFormatter, skipThisClass: true
                                                      );
            }



            return(CreateLogger(name, loggerConfig));
        }