Esempio n. 1
0
 public long Add(AtomLogger log)
 {
     try
     {
         throw new Exception("这个有问题哦");
         var result = SonFact.Cur.Insert(log);
         return(result);
     }
     catch (Exception e)
     {
         var errMsg   = e.Message;
         var innerErr = e.InnerException != null ? e.InnerException.Message + " StackTrace: " + e.InnerException.StackTrace : "";
         SaveToFile("Error:" + errMsg + " InnerError:" + innerErr, 4);
         return(1);
     }
 }
Esempio n. 2
0
        public static bool Monitor(string logUrl = "", string user = null, long contentSize = 0, long duration = 0, string logType = "monitor", string param = "")
        {
            var log = new AtomLogger()
            {
                LogType       = logType,
                LogLevel      = (int)LogLevel.Monitor,
                LogUser       = user,
                AddTime       = DateTime.Now,
                LogTxt        = param,
                LogUrl        = logUrl,
                ContentLength = 0,
                Duration      = duration,
                ServerSrc     = ServerSrc
            };

            return(Logmgt.Add(log) > 0);
        }
Esempio n. 3
0
        public static bool Fatal(string txt, string logType = "std", string user = null)
        {
            var log = new AtomLogger()
            {
                LogType       = logType,
                LogLevel      = (int)LogLevel.Fatal,
                LogUser       = user,
                AddTime       = DateTime.Now,
                LogTxt        = txt,
                ContentLength = 0,
                Duration      = 0,
                LogUrl        = null,
                ServerSrc     = ServerSrc
            };

            return(Logmgt.Add(log) > 0);
        }
Esempio n. 4
0
        public static bool Exception(Exception ex, string logType = "exception", string user = null, string txt = "")
        {
            var innerEx = ex.InnerException != null ? ex.InnerException.Message : "";

            var log = new AtomLogger()
            {
                LogType       = logType,
                LogLevel      = (int)LogLevel.Exception,
                LogUser       = user,
                AddTime       = DateTime.Now,
                LogTxt        = ex.Message + " | " + innerEx,
                LogUrl        = ex.StackTrace,
                ContentLength = 0,
                Duration      = 0,
                ServerSrc     = ServerSrc
            };

            return(Logmgt.Add(log) > 0);
        }