Exemplo n.º 1
0
 internal void CreateLogFolderIfNotFound()
 {
     if (!Directory.Exists(LogFolder))
     {
         Directory.CreateDirectory(LogFolder);
     }
     LogConstants.ProvideFullAccess(LogFolder);
 }
Exemplo n.º 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));
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 4
0
        private static LogConfig GetLogConfig()
        {
            string path = LogConstants.GetSetupDir() + @"\logger.xml";

            return(LogConstants.DeserializeLogConfig(path));
        }
Exemplo n.º 5
0
        public Log(string configFilePath)
        {
            LogConfig logConfig = LogConstants.DeserializeLogConfig(configFilePath);

            Initialize(logConfig);
        }