コード例 #1
0
 public AccountController(IEmailComposer emailComposer, IEmailer emailer, IDiObjectMapper mapper, IApplicationLogService applicationLogService)
 {
     _emailComposer         = emailComposer;
     _emailer               = emailer;
     _mapper                = mapper;
     _applicationLogService = applicationLogService;
 }
コード例 #2
0
 public void EstablishNotAuthenticatedContext()
 {
     agencyContext = new AgencyContext();
     calendar = new Mock<ICalendarService>();
     calendar.Expect(c => c.CurrentDateTime).Returns(new DateTime(2009, 1, 29));
     context = new Mock<ICanAddToContext>();
     context.Expect(c => c.AddToContext(It.IsAny<ApplicationLog>())).Verifiable();
     applicationLogService = new ApplicationLogService(agencyContext, calendar.Object, context.Object);
 }
コード例 #3
0
        private ApplicationLogService(ILog log, string userName)
        {
            _log = log;

            if (!string.IsNullOrEmpty(userName))
            {
                log4net.MDC.Set("auth", userName);
            }

            _theInstance = this;
        }
コード例 #4
0
        private ApplicationLogService(Type callingType, string userName, int stackDepth)
        {
            //StackTrace stackTrace = new StackTrace(stackDepth + 1);
            //MethodBase methodBase = stackTrace.GetFrame(0).GetMethod();
            //Type callingType = methodBase.DeclaringType;

            _log = log4net.LogManager.GetLogger(callingType);

            if (!string.IsNullOrEmpty(userName))
            {
                log4net.MDC.Set("auth", userName);
            }

            _theInstance = this;
        }
コード例 #5
0
 public static void EnableLogging(Type callingType)
 {
     IApplicationLogService log = ApplicationLogService.InitializeLogger(log4net.LogManager.GetLogger(callingType), null);
 }