Browse Source

#IQRV #comment [Chromium] 修改了publicFun,修改为日期开头的log文件

陈良瑜80374463 3 years ago
parent
commit
07b7d738d1
1 changed files with 5 additions and 5 deletions
  1. 5 5
      Other/libpublicFun/exLog/log.cpp

+ 5 - 5
Other/libpublicFun/exLog/log.cpp

@@ -49,12 +49,12 @@ bool logger::init(std::string strLogPath, std::string strLogName) {
 		boost::make_shared<logging::sinks::text_multifile_backend>();
 		boost::make_shared<logging::sinks::text_multifile_backend>();
 	// Set up the file naming pattern
 	// Set up the file naming pattern
 	backend->set_file_name_composer(logging::sinks::file::as_file_name_composer(
 	backend->set_file_name_composer(logging::sinks::file::as_file_name_composer(
-		logexpr::stream << strLogPath 
-		<< "/" << strLogName << "."
+		logexpr::stream << strLogPath
+		<< "/" << logexpr::format_date_time<boost::posix_time::ptime>("TimeStamp", "%Y%m%d") << "_"
 		// 文件名还是带上Level,否者copy到一起的时候分不清
 		// 文件名还是带上Level,否者copy到一起的时候分不清
-		<< logexpr::attr<logging::trivial::severity_level>("Severity") << "."
-		<< logexpr::attr<std::string>("RotationDate") << ".log"));
-
+		<< logexpr::attr<logging::trivial::severity_level>("Severity") << "_"
+		<< strLogName << ".log"));
+	
 	sink = boost::shared_ptr<sink_t>(new sink_t(backend));
 	sink = boost::shared_ptr<sink_t>(new sink_t(backend));
 	// Set the formatter
 	// Set the formatter
 	sink->set_formatter(logexpr::stream
 	sink->set_formatter(logexpr::stream