Esempio n. 1
0
        public static LogLevel FromName(string name)
        {
            string nam = name.ToLower();
            var res =new LogLevel();
            switch (nam)
            {
                case "none":
                {
                    res = None;

                }
                    break;
                case "information":
                {
                    res = Information;

                }
                    break;
                case "warning":
                {
                    res = Warning;

                }
                    break;
                case "error":
                {
                    res = Error;

                }
                    break;
                case "accesscontrol":
                {
                    res = AccessControl;

                }
                    break;

            }
            return res;
        }
Esempio n. 2
0
        public Log(long id, string code, LogLevel logLevel, User user, string className,
           string methodName, string title, string messages)
        {
            this.id = id;
            this.code = code;
            this.logLevel = logLevel;
            if (user != null)
                this.partyId = user.Id;
            this.className = className;
            this.methodName = methodName;
            this.logDate = DateTime.Now;
            this.logLevelId =(int)logLevel;

            if (!string.IsNullOrEmpty(title) && title.Length > 200)
                this.title = title.Substring(0, 199);
            else
                this.title = title;

            if (!string.IsNullOrEmpty(messages) && messages.Length > 4000)
                this.messages = messages.Substring(0, 3999);
            else
                this.messages = messages;
        }
Esempio n. 3
0
 public EventLog(long id, string code, LogLevel logLevel, User party, string className,
    string methodName, string title, string messages)
     : base(id, code, logLevel, party, className, methodName, title, messages)
 {
 }
Esempio n. 4
0
 public Log AddExceptionLog(string code, LogLevel logLevel, User user, string className,
                   string methodName, string title, string messages)
 {
     var log = new EventLog(0, code, logLevel, user, className, methodName, title, messages);
     return logManagerService.AddLog(log);
 }