当前位置: 首页 > news >正文

什么是营销型的网站推广平台网站很难做

什么是营销型的网站推广,平台网站很难做,响应式模板网站模板,深圳网站维护页面设计设计目标: 1、每个Logging source对应一个目录#xff0c;可以设置日志文件数#xff0c;日志大小#xff0c;目录名#xff0c;文件名等 2、所有logging source日志目录都在一个根目录下。 3、可以动态创建和删除logging source 4、打印出日期时间和日志严重等级 示例代码…设计目标: 1、每个Logging source对应一个目录可以设置日志文件数日志大小目录名文件名等 2、所有logging source日志目录都在一个根目录下。 3、可以动态创建和删除logging source 4、打印出日期时间和日志严重等级 示例代码: #include libs/Core/LogMananger.hint main(){LogManager::instance().setRootPath(logs);LogManager::instance().addLogger(network, network, 1024*100, 10);LogManager::instance().addLogger(db, db, 1024*100, 10);for(int i 0; i 10000; i){LOG(network, info) hello world aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;LOG(network, trace) hello world aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;LOG(network, warning) hello world aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;LOG(network, fatal) hello world ;LOG(network, debug) hello world;LOG(db, info) hello world aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;LOG(db, trace) hello world aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;LOG(db, warning) hello world aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;LOG(db, fatal) hello world;LOG(db, debug) hello world;}return 0; } 生成的日志目录结构: 日志格式: LogManager.h #pragma once #include boost/log/trivial.hpp #include boost/log/sources/severity_logger.hpp #include boost/log/sources/logger.hpp #include boost/log/sources/basic_logger.hpp #include boost/log/sinks.hpp #include boost/log/core.hpp #include boost/log/utility/setup/file.hpp #include boost/log/sinks.hpp #include boost/core/null_deleter.hpp #include boost/log/attributes.hpp #include boost/log/utility/setup/console.hpp #include boost/log/attributes/constant.hpp #include boost/log/exceptions.hpp #include boost/log/keywords/format.hpp #include boost/log/expressions.hpp #include boost/log/expressions/formatters/date_time.hpp #include boost/log/support/date_time.hpp #include boost/log/utility/setup/common_attributes.hpp#include memory #include map #include fstream #include iostream #include string #include mutex using namespace std; namespace sources boost::log::sources; namespace sinks boost::log::sinks; namespace expressions boost::log::expressions; namespace trivial boost::log::trivial; namespace keywords boost::log::keywords; namespace attributes boost::log::attributes;class LogManager {struct LoggerInfo{string m_strName;string m_strPath;int m_nMaxSize;int m_nMaxCount;boost::shared_ptrsources::severity_logger_mttrivial::severity_level m_pLogger;boost::shared_ptrsinks::synchronous_sinksinks::text_file_backend m_pSink;}; public:~LogManager();static LogManager instance();void setRootPath(const string strRootPath );void addLogger(const string strName, const string strPath, int nMaxSize, int nMaxCount);void removeLogger(const string strName);boost::log::sources::severity_logger_mttrivial::severity_level getLogger(const string strName); private:LogManager(); private:string m_strRootPath;mapstring, LoggerInfo m_mapLogger;mutex m_oLock; };#define LOG(name, level) BOOST_LOG_SEV(LogManager::instance().getLogger(#name), boost::log::trivial::severity_level::level) LogManager.cpp #include LogMananger.hLogManager::LogManager() {}LogManager::~LogManager() {}LogManager LogManager::instance() {static LogManager t;return t; }void LogManager::setRootPath(const string strRootPath) {m_strRootPath strRootPath; }void LogManager::addLogger(const string strName, const string strPath, int nMaxSize, int nMaxCount) {lock_guardmutex lk(m_oLock);if(m_mapLogger.contains(strName))return;m_mapLogger[strName] LoggerInfo();m_mapLogger[strName].m_strName strName;m_mapLogger[strName].m_strPath strPath;m_mapLogger[strName].m_nMaxSize nMaxSize;m_mapLogger[strName].m_nMaxCount nMaxCount;m_mapLogger[strName].m_pLogger boost::make_sharedsources::severity_logger_mttrivial::severity_level();m_mapLogger[strName].m_pLogger-add_attribute(LoggerName, attributes::constantstring(strName));m_mapLogger[strName].m_pLogger-add_attribute(DateTime, attributes::local_clock());boost::shared_ptrsinks::text_file_backend pTxtFileBackend boost::make_sharedsinks::text_file_backend( keywords::file_name m_strRootPath / strPath / strName .log, //是日志文件大小没达到最大值时,日志写的文件keywords::target_file_name strName _%2N.log, //当日志文件达到最大值时日志文件名会被改写这里的%2N表示用两位数字表示keywords::rotation_size nMaxSize, //单个日志文件最大值这里是5Mkeywords::open_mode std::ios_base::out | std::ios_base::app, //添加模式keywords::time_based_rotation sinks::file::rotation_at_time_point(12, 0, 0)); //每天12点会重新生成一个日志文件不管日志文件是否到了最大值m_mapLogger[strName].m_pSink boost::make_sharedsinks::synchronous_sinksinks::text_file_backend(pTxtFileBackend);m_mapLogger[strName].m_pSink-locked_backend()-set_file_collector(sinks::file::make_collector(keywords::max_files nMaxCount, //最多N个日志文件keywords::max_size nMaxSize*(1nMaxCount), //正目录最大占用多少磁盘空间keywords::target m_strRootPath / strPath //日志保存的目录前面target_file_name所在的目录));m_mapLogger[strName].m_pSink-locked_backend()-auto_flush(true);m_mapLogger[strName].m_pSink-locked_backend()-scan_for_files();m_mapLogger[strName].m_pSink-set_formatter(expressions::stream expressions::if_(expressions::has_attrboost::posix_time::ptime(DateTime))[expressions::stream [ expressions::format_date_time boost::posix_time::ptime (DateTime, %Y-%m-%d %H:%M:%S.%f) ] ] [ trivial::severity ] expressions::smessage);m_mapLogger[strName].m_pSink-set_filter(expressions::has_attr(LoggerName) expressions::attrstring(LoggerName) strName);boost::log::core::get()-add_sink(m_mapLogger[strName].m_pSink); }void LogManager::removeLogger(const string strName) {lock_guardmutex lk(m_oLock);if(m_mapLogger.contains(strName))boost::log::core::get()-remove_sink(m_mapLogger[strName].m_pSink); }sources::severity_logger_mttrivial::severity_level LogManager::getLogger(const string strName) {lock_guardmutex lk(m_oLock);return *m_mapLogger[strName].m_pLogger; }
http://www.pierceye.com/news/960980/

相关文章:

  • 文化馆网站建设做直播的网站有哪些
  • 网站首页怎样排版如何把网站放在根目录
  • 昭通网站开发公司企业网站包含的要素
  • 网站手机版下悬浮条怎么做农产品信息网站的建设
  • 有关网站开发的文章做微商网站的软文
  • 做网站公司起什么名字西安官网seo技术
  • zepto网站开发用帝国cms做的网站首页
  • 手机影视网站制作一站式服务大厅官网
  • 创意网站展示汕尾百度seo公司
  • 网站被spider重复抓取自主建站网站平台
  • 网站打开小企业网站建设哪里做得好
  • 网站开发+进度表什么牛网站建设
  • 不同类型网站比较及网站域名设计整站优化
  • 高端企业网站建设规定陕西关键词优化推荐
  • 做图表的网站推荐简单的个人网站模板
  • 淄博瓷砖网站建设中企动力永久免费虚拟主机
  • 厦门网站建设创建有哪些python wordpress采集
  • 如何建立网站链接百度账号设置
  • 网站的申请淄博市住房和城乡建设厅网站
  • 重庆网站设计开发杂志网站模板
  • 网站建设需要营业执照吗建站之星源码下载
  • 网站建设需要基础吗做游戏的软件app
  • 网站建设费用分几年摊销网站建设动态
  • 企业网站的网址通常包含网站建设总结会上 领导讲话稿
  • 营销型网站五大系统 单仁网站开发个人简历
  • 网站内容的编辑和更新怎么做的免费的网站制作
  • 做网站 0元代理下载站源码cms
  • 台州市建设局招聘网站wordpress更新计划
  • 有教做路桥质检资料的网站吗企业画册印刷
  • 四川省营山县西城建筑公司网站租服务器 wordpress