Пример #1
0
 internal void CreateLogFolderIfNotFound()
 {
     if (!Directory.Exists(LogFolder))
     {
         Directory.CreateDirectory(LogFolder);
     }
     LogConstants.ProvideFullAccess(LogFolder);
 }
Пример #2
0
        private string GetLogXsltContent()
        {
            string applicationPath = LogConstants.GetSetupDir() + "\\";
            string content         = (string.IsNullOrWhiteSpace(logConfig.FileLogSource.LogXslt)) ?
                                     GetXmlEmbeddedResourceContent("log.xslt") :
                                     GetFileContent(applicationPath + logConfig.FileLogSource.LogXslt);

            return(AddXmlHeader(content));
        }
Пример #3
0
        public void Write(
            LogState state,
            string topic,
            string description,
            Exception exception = null,
            string user         = "",
            string category     = "",
            string custom       = "")
        {
            string categoryValue = category;
            Logger logger        = DefaultLogger;

            if (logger != null)
            {
                if (
                    (logger.Name == categoryValue)
                    &&
                    (logger.Level < (int)LogConstants.GetLogLevel(state)))
                {
                    return;
                }
                categoryValue = logger.Name;
            }
            if (user == string.Empty)
            {
                user = DefaultUser;
            }
            if (FileLog.IsEnabled)
            {
                lock (thisLock)
                {
                    FileLog.WriteLog(
                        state,
                        StackInfo(state, exception),
                        topic,
                        description,
                        categoryValue,
                        user,
                        custom);
                }
            }
            if (DbLog.IsEnabled)
            {
                DbLog.WriteLog(
                    state,
                    StackInfo(state, exception),
                    topic,
                    description,
                    user,
                    categoryValue,
                    custom);
            }
        }
Пример #4
0
        private static LogConfig GetLogConfig()
        {
            string path = LogConstants.GetSetupDir() + @"\logger.xml";

            return(LogConstants.DeserializeLogConfig(path));
        }
Пример #5
0
        public Log(string configFilePath)
        {
            LogConfig logConfig = LogConstants.DeserializeLogConfig(configFilePath);

            Initialize(logConfig);
        }