Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            #region Logger Test
            // Application_Start'da bir kere çalıştırılacak, injection için.
            IoCResolver.getInstance.Resolve <LoggerContext, FileLogger>();

            // Tüm projede injection yapılan tipte çalışacaktır.
            LoggerContext.Log(MethodBase.GetCurrentMethod(), "blabla");
            #endregion
        }
Ejemplo n.º 2
0
        // GET api/values
        public IEnumerable <string> Get()
        {
            var a = LoggerContext.Log(ConverterBll.Location(ActionContext), new LogUserInfoSurragateType()
            {
                LogKategori = "", LogTuru = LogTuru.Bilgi, LogIcerik = $"{1} kodu ile birşey oldu"
            });


            return(new string[] { "value1", "value2" });
        }
Ejemplo n.º 3
0
        public override void OnActionExecuting(HttpActionContext httpActionContext)
        {
            var userEmail = ConverterBll.Email(httpActionContext.RequestContext);
            var location  = ConverterBll.Location(httpActionContext);

            LoggerContext.Log(location,
                              new LogUserInfoSurragateType()
            {
                UserKey     = userEmail,
                LogKategori = "",
                LogTuru     = LogTuru.Bilgi,
                LogIcerik   = "Istek Yapıldı.."
            });
            base.OnActionExecuting(httpActionContext);
        }
Ejemplo n.º 4
0
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            var httpActionContext = actionExecutedContext.ActionContext;
            var userEmail         = ConverterBll.Email(httpActionContext.RequestContext);
            var location          = ConverterBll.Location(httpActionContext);


            LoggerContext.Log(location,
                              new LogUserInfoSurragateType()
            {
                UserKey     = userEmail,
                LogKategori = "",
                LogTuru     = LogTuru.Hata,
                LogIcerik   = actionExecutedContext.Exception.Message
            });


            #region Respose Düzenleme
            //actionExecutedContext.Response = actionExecutedContext.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, actionExecutedContext.Exception.Message);
            //actionExecutedContext.Response.Headers.Add("HataID", logkaydi.ID.ToString());
            #endregion
            base.OnException(actionExecutedContext);
        }