public static void Trace(this IGrinderLogger logger, Action <LogMessageHandler> messageCallback)
 {
     if (logger.IsTraceEnabled)
     {
         logger.Trace(FormatMessage(messageCallback));
     }
 }
 public static void Info(this IGrinderLogger logger, Action <LogMessageHandler> messageCallback)
 {
     if (logger.IsInfoEnabled)
     {
         logger.Info(FormatMessage(messageCallback));
     }
 }
 public static void Debug(this IGrinderLogger logger, Action <LogMessageHandler> messageCallback)
 {
     if (logger.IsDebugEnabled)
     {
         logger.Debug(FormatMessage(messageCallback));
     }
 }
 public static void Error(this IGrinderLogger logger, Action <LogMessageHandler> messageCallback)
 {
     if (logger.IsErrorEnabled)
     {
         logger.Error(FormatMessage(messageCallback));
     }
 }
        public void Initialize()
        {
            if (GrinderContext == null)
            {
                throw new AwarenessException("GrinderContext == null");
            }

            Logger = new LoggerFacade(GrinderContext.GetLogger(GetType()), GrinderContext);
            Logger.Trace("Initialize: Enter");
            TypeHelper = new TypeHelper(GrinderContext);
            OnInitialize();
            Logger.Trace("Initialize: Exit");
        }
        public void Initialize()
        {
            if (GrinderContext == null)
            {
                throw new AwarenessException("GrinderContext == null");
            }

            Logger = new LoggerFacade(GrinderContext.GetLogger(GetType()), GrinderContext);
            Logger.Trace("Initialize: Enter");
            TypeHelper = new TypeHelper(GrinderContext);
            OnInitialize();
            Logger.Trace("Initialize: Exit");
        }
示例#7
0
        public LoggerFacade(IGrinderLogger underlying, IGrinderContext grinderContext)
        {
            if (underlying == null)
            {
                throw new ArgumentNullException("underlying");
            }

            if (grinderContext == null)
            {
                throw new ArgumentNullException("grinderContext");
            }

            this.underlying = underlying;
            SetupLoggerEnabledValueResolvers(grinderContext);
        }
        public LoggerFacade(IGrinderLogger underlying, IGrinderContext grinderContext)
        {
            if (underlying == null)
            {
                throw new ArgumentNullException("underlying");
            }

            if (grinderContext == null)
            {
                throw new ArgumentNullException("grinderContext");
            }

            this.underlying = underlying;
            SetupLoggerEnabledValueResolvers(grinderContext);
        }
        public void Shutdown()
        {
            SafeLog(() => Logger.Trace("Shutdown: Enter"));

            try
            {
                OnShutdown();
            }
            finally
            {
                SafeLog(() => Logger.Trace("Shutdown: Exit"));

                GrinderContext = null;
                Logger = null;
            }
        }
        public void Shutdown()
        {
            SafeLog(() => Logger.Trace("Shutdown: Enter"));

            try
            {
                OnShutdown();
            }
            finally
            {
                SafeLog(() => Logger.Trace("Shutdown: Exit"));

                GrinderContext = null;
                Logger         = null;
            }
        }