/// <summary> /// 功能:记录日志消息 /// </summary> /// <param name="writeLogType">写日志类型</param> /// <param name="logLevel">日志级别</param> /// <param name="logSource">日志的来源</param> /// <param name="logValue">需记录的日志值</param> /// <param name="logAddition">日志附加信息</param> public FeedBackResponse <string> WriteLog(WriteLogType writeLogType, LogLevel logLevel, string logSource, string logValue, string logAddition) { FeedBackResponse <string> fbrTemp01 = null; FeedBackResponse <string> fbrTemp02 = null; FeedBackResponse <string> fbrTemp03 = null; FeedBackResponse <string> fbrReturn = new FeedBackResponse <string>(); switch (writeLogType) { case WriteLogType.FileLog: fbrReturn = LogServiceHelper.WriteFileLog(logLevel, logSource, logValue, logAddition); break; case WriteLogType.DataBaseLog: fbrReturn = LogServiceHelper.WriteDataBaseLog(logLevel, logSource, logValue, logAddition); break; case WriteLogType.FileDataBaseLog: fbrTemp01 = LogServiceHelper.WriteFileLog(logLevel, logSource, logValue, logAddition); fbrTemp02 = LogServiceHelper.WriteDataBaseLog(logLevel, logSource, logValue, logAddition); CombineResponse(fbrReturn, fbrTemp01, fbrTemp02, fbrTemp03); break; case WriteLogType.AllLog: fbrTemp01 = LogServiceHelper.WriteFileLog(logLevel, logSource, logValue, logAddition); fbrTemp02 = LogServiceHelper.WriteDataBaseLog(logLevel, logSource, logValue, logAddition); break; } return(fbrReturn); }
public void RunManager(string logPathDirectory) { _logFiles = LogServiceHelper.GetDirectoryFiles(logPathDirectory); _bookmarkCollection = new HashSet <LogFileBookmark>(); //check to see if the cache file for bookmarks exist if (File.Exists(_CACHE_FILE)) { //update the bookmarks file by checking the cache file for its latest bookmark and from there check to see //if there are new entries and then check for new files different than what is inside of the cache StreamReader sr = new StreamReader(_CACHE_FILE); } else { foreach (string logFilePath in _logFiles.Keys) { ParseFile(logFilePath, 0); } //Cache the bookmarks made when parsing the file StreamWriter sw = new StreamWriter(_CACHE_FILE); foreach (LogFileBookmark bookmark in _bookmarkCollection) { sw.WriteLine(bookmark.BookmarkDescription); } sw.Flush(); } }
/// <summary> /// Set the location of the log files and create bookmarks for each of these log files. /// </summary> /// <param name="path">Directory that holds all the log files</param> public void SetDataEngine(string path) { AzureEnvironment e = new AzureEnvironment(); _logFiles = LogServiceHelper.GetDirectoryFiles(e.LogFiles); //LogFileBookmarkManager bookmarkManager = new LogFileBookmarkManager(); //bookmarkManager.RunManager(path); }
/// <summary> /// 功能:搜索日志数据列表 /// </summary> /// <param name="strLevel">日志级别</param> /// <param name="strSource">日志来源</param> /// <param name="dtmStartTime">日志起始时间</param> /// <param name="dtmEndTime">日志结束时间</param> /// <param name="strMessage">日志信息</param> /// <param name="strAddition">附加信息</param> /// <returns>日志数据列表 </returns> public FeedBackResponse <List <TCommonlog> > SearchLogData(string strLevel, string strSource, DateTime dtmStartTime, DateTime?dtmEndTime, string strMessage, string strAddition) { return(LogServiceHelper.SearchLogData(strLevel, strSource, dtmStartTime, dtmEndTime, strMessage, strAddition)); }
/// <summary> /// 功能:搜索日志文件列表 /// </summary> /// <param name="strSearchName">搜索名称</param> /// <returns>日志文件列表</returns> public FeedBackResponse <List <string> > SearchLogFiles(string strSearchName) { return(LogServiceHelper.SearchLogFiles(strSearchName)); }
/// <summary> /// 功能:获取日志文件内容 /// </summary> /// <param name="strLogFileName">日志文件名称或路径</param> /// <returns>日志文件内容</returns> public FeedBackResponse <string> GetLogFileContent(string strLogFileName) { return(LogServiceHelper.GetLogFileContent(strLogFileName)); }
/// <summary> /// 功能:测试日志 /// </summary> public FeedBackResponse <string> TestLog() { return(LogServiceHelper.TestLog()); }