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

成都访问公司网站百度seo刷排名工具

成都访问公司网站,百度seo刷排名工具,设计招聘网站,网站帮企业做推广价格怎么算不讲理论,直接上在程序中可用代码: 一、引入Boost模块 开发环境:Visual Studio 2017 Boost库版本:1.68.0 安装方式:Nuget 安装命令: #只安装下面几个即可 Install-package boost -version 1.68.0 Install…

不讲理论,直接上在程序中可用代码:
一、引入Boost模块

开发环境:Visual Studio 2017
Boost库版本:1.68.0
安装方式:Nuget
安装命令:

#只安装下面几个即可
Install-package boost -version 1.68.0
Install-package boost_filesystem-vc141 -version 1.68.0
Install-package boost_log_setup-vc141 -version 1.68.0
Install-package boost_log-vc141 -version 1.68.0#这里是其他模块,可不安装
Install-package boost_atomic-vc141 -version 1.68.0
Install-package boost_chrono-vc141 -version 1.68.0
Install-package boost_date_time-vc141 -version 1.68.0
Install-package boost_system-vc141 -version 1.68.0
Install-package boost_thread-vc141 -version 1.68.0
Install-package boost_locale-vc141 -version 1.68.0

调用Nuget控制台:

 

二、引入下面两个hpp文件
boost_logger.hpp

#pragma once#include <string>
#include <fstream>
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/core/null_deleter.hpp>
#include <boost/log/core.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/async_frontend.hpp>
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/support/date_time.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/attributes/current_thread_id.hpp>
#include <boost/log/attributes/current_process_name.hpp>
#include <boost/log/attributes/attribute.hpp>
#include <boost/log/attributes/attribute_cast.hpp>
#include <boost/log/attributes/attribute_value.hpp>
#include <boost/log/sinks/async_frontend.hpp>// Related headersQDebug
#include <boost/log/sinks/unbounded_fifo_queue.hpp>
#include <boost/log/sinks/unbounded_ordering_queue.hpp>
#include <boost/log/sinks/bounded_fifo_queue.hpp>
#include <boost/log/sinks/bounded_ordering_queue.hpp>
#include <boost/log/sinks/drop_on_overflow.hpp>
#include <boost/log/sinks/block_on_overflow.hpp>//这里是logger的头文件,后面根据实际路径引入
#include "logger.hpp"//引入各种命名空间
namespace logging = boost::log;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
namespace sinks = boost::log::sinks;
namespace keywords = boost::log::keywords;
namespace attrs = boost::log::attributes;
//建立日志源,支持严重属性
thread_local static boost::log::sources::severity_logger<log_level> lg;#define BOOST_LOG_Q_SIZE 1000//创建输出槽:synchronous_sink是同步前端,允许多个线程同时写日志,后端无需考虑多线程问题
typedef sinks::asynchronous_sink<sinks::text_file_backend, sinks::bounded_fifo_queue<BOOST_LOG_Q_SIZE, sinks::block_on_overflow>> sink_t;
static std::ostream &operator<<(std::ostream &strm, log_level level)
{static const char *strings[] ={"debug","info","warn","error","critical"};if (static_cast<std::size_t>(level) < sizeof(strings) / sizeof(*strings))strm << strings[level];elsestrm << static_cast<int>(level);return strm;
}
class boost_logger : public logger_iface
{
public:boost_logger(const std::string& dir) : m_level(log_level::error_level), dir(dir){}~boost_logger(){}/*** 日志初始化*/void init() override{//判断日志文件所在路径是否存在if (boost::filesystem::exists(dir) == false){boost::filesystem::create_directories(dir);}//添加公共属性logging::add_common_attributes();//获取日志库核心core = logging::core::get();//创建后端,并设值日志文件相关控制属性boost::shared_ptr<sinks::text_file_backend> backend = boost::make_shared<sinks::text_file_backend>(keywords::open_mode = std::ios::app, // 采用追加模式keywords::file_name = dir + "/%Y%m%d_%N.log", //归档日志文件名keywords::rotation_size = 10 * 1024 * 1024, //超过此大小自动建立新文件keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), //每隔指定时间重建新文件keywords::min_free_space = 100 * 1024 * 1024  //最低磁盘空间限制);if (!_sink){_sink.reset(new sink_t(backend));//向日志源添加槽core->add_sink(_sink);}//添加线程ID公共属性core->add_global_attribute("ThreadID", attrs::current_thread_id());//添加进程公共属性core->add_global_attribute("Process", attrs::current_process_name());//设置过滤器_sink->set_filter(expr::attr<log_level>("Severity") >= m_level);// 如果不写这个,它不会实时的把日志写下去,而是等待缓冲区满了,或者程序正常退出时写下// 这样做的好处是减少IO操作,提高效率_sink->locked_backend()->auto_flush(true); // 使日志实时更新//这些都可在配置文件中配置_sink->set_formatter(expr::stream<< "["<< expr::attr<std::string>("Process") << ":" << expr::attr<attrs::current_thread_id::value_type>("ThreadID") << ":"<< expr::attr<unsigned int>("LineID") << "]["<< expr::format_date_time<boost::posix_time::ptime>("TimeStamp", "%Y-%m-%d %H:%M:%S.%f") << "]["<< expr::attr<log_level>("Severity") << "] "<< expr::smessage);}/*** 停止记录日志*/void stop() override{warn_log("boost logger stopping");_sink->flush();_sink->stop();core->remove_sink(_sink);}/*** 设置日志级别*/void set_log_level(log_level level) override{m_level = level;if (_sink){_sink->set_filter(expr::attr<log_level>("Severity") >= m_level);}}log_level get_log_level() override{return m_level;}void debug_log(const std::string &msg) override{BOOST_LOG_SEV(lg, debug_level) << msg << std::endl;}void info_log(const std::string &msg) override{BOOST_LOG_SEV(lg, info_level) << blue << msg << normal << std::endl;}void warn_log(const std::string &msg) override{BOOST_LOG_SEV(lg, warn_level) << yellow << msg << normal << std::endl;}void error_log(const std::string &msg) override{BOOST_LOG_SEV(lg, error_level) << red << msg << normal << std::endl;}void critical_log(const std::string &msg) override{BOOST_LOG_SEV(lg, critical_level) << red << msg << normal << std::endl;}private:log_level m_level;boost::shared_ptr<logging::core> core;boost::shared_ptr<sink_t> _sink;//日志文件路径const std::string& dir;
};

logger.hpp

#pragma once
#define BOOST_ALL_DYN_LINK#include <string>   // std::string
#include <iostream> // std::cout
#include <fstream>
#include <sstream> // std::ostringstream
#include <memory>typedef std::basic_ostringstream<char> tostringstream;
static const char black[] = {0x1b, '[', '1', ';', '3', '0', 'm', 0};
static const char red[] = {0x1b, '[', '1', ';', '3', '1', 'm', 0};
static const char yellow[] = {0x1b, '[', '1', ';', '3', '3', 'm', 0};
static const char blue[] = {0x1b, '[', '1', ';', '3', '4', 'm', 0};
static const char normal[] = {0x1b, '[', '0', ';', '3', '9', 'm', 0};
#define ACTIVE_LOGGER_INSTANCE (*activeLogger::getLoggerAddr())
// note: this will replace the logger instace. If this is not the first time to set the logger instance.
// Please make sure to delete/free the old instance.
#define INIT_LOGGER(loggerImpPtr)              \{                                           \ACTIVE_LOGGER_INSTANCE = loggerImpPtr;    \ACTIVE_LOGGER_INSTANCE->init();           \}
#define CHECK_LOG_LEVEL(logLevel) (ACTIVE_LOGGER_INSTANCE ? ((ACTIVE_LOGGER_INSTANCE->get_log_level() <= log_level::logLevel##_level) ? true : false) : false)
#define SET_LOG_LEVEL(logLevel)                                                   \{                                                                              \if (ACTIVE_LOGGER_INSTANCE)                                                  \(ACTIVE_LOGGER_INSTANCE->set_log_level(log_level::logLevel##_level));      \}
#define DESTROY_LOGGER                      \{                                        \if (ACTIVE_LOGGER_INSTANCE)            \{                                      \ACTIVE_LOGGER_INSTANCE->stop();      \delete ACTIVE_LOGGER_INSTANCE;       \}                                      \}enum log_level
{debug_level = 0,info_level,warn_level,error_level,critical_level
};class logger_iface
{
public:logger_iface(void) = default;virtual ~logger_iface(void) = default;logger_iface(const logger_iface &) = default;logger_iface &operator=(const logger_iface &) = default;public:virtual void init() = 0;virtual void stop() = 0;virtual void set_log_level(log_level level) = 0;virtual log_level get_log_level() = 0;virtual void debug_log(const std::string &msg) = 0;virtual void info_log(const std::string &msg) = 0;virtual void warn_log(const std::string &msg) = 0;virtual void error_log(const std::string &msg) = 0;virtual void critical_log(const std::string &msg) = 0;
};class activeLogger
{
public:static logger_iface **getLoggerAddr(){static logger_iface *activeLogger;return &activeLogger;}
};#define __LOGGING_ENABLED#ifdef __LOGGING_ENABLED
#define __LOG(level, msg)                                                       \\{                                                                            \tostringstream var;                                                        \var << "[" << __FILE__ << ":" << __LINE__ << ":" << __func__ << "] \n"     \<< msg;                                                                  \if (ACTIVE_LOGGER_INSTANCE)                                                \ACTIVE_LOGGER_INSTANCE->level##_log(var.str());                          \}
#else
#define __LOG(level, msg)
#endif /* __LOGGING_ENABLED */

三、使用样例

#include "logger/boost_logger.hpp"
#include "logger/simpleLogger.hpp"void testCustomLogger() {//初始化日志对象:日志路径后期从配置文件读取const std::string logDir = "E:\\log";INIT_LOGGER(new boost_logger(logDir));//设置过滤级别(可以读取配置文件)SET_LOG_LEVEL(debug);//输出各级别日志,(void *)ACTIVE_LOGGER_INSTANCE:代表激活的日志实例(可不写)__LOG(critical, "hello logger!"<< "this is critical log" << (void *)ACTIVE_LOGGER_INSTANCE);__LOG(debug, "hello logger!!!!!!!!!!!!!!!"<< "this is debug log");
}


文章转载自:
http://consistence.rnds.cn
http://sinusoid.rnds.cn
http://lamed.rnds.cn
http://jumbo.rnds.cn
http://catechise.rnds.cn
http://bohai.rnds.cn
http://glaciated.rnds.cn
http://weighbeam.rnds.cn
http://bey.rnds.cn
http://gnatcatcher.rnds.cn
http://twiggery.rnds.cn
http://vagary.rnds.cn
http://millimeter.rnds.cn
http://kiang.rnds.cn
http://wildcatter.rnds.cn
http://tamarugo.rnds.cn
http://hemophiliac.rnds.cn
http://pingo.rnds.cn
http://wimpy.rnds.cn
http://popeyed.rnds.cn
http://phasedown.rnds.cn
http://flyflap.rnds.cn
http://radio.rnds.cn
http://vasculitic.rnds.cn
http://screenland.rnds.cn
http://smirnoff.rnds.cn
http://penalize.rnds.cn
http://wady.rnds.cn
http://amphion.rnds.cn
http://twaddell.rnds.cn
http://notts.rnds.cn
http://alkoran.rnds.cn
http://portaltoportal.rnds.cn
http://deformalize.rnds.cn
http://sociogeny.rnds.cn
http://qiana.rnds.cn
http://assuringly.rnds.cn
http://maybe.rnds.cn
http://linac.rnds.cn
http://bony.rnds.cn
http://greenbug.rnds.cn
http://counteragent.rnds.cn
http://prevision.rnds.cn
http://aphis.rnds.cn
http://ubykh.rnds.cn
http://glassy.rnds.cn
http://exquisitely.rnds.cn
http://sandek.rnds.cn
http://fossilization.rnds.cn
http://woke.rnds.cn
http://bolsheviki.rnds.cn
http://fargo.rnds.cn
http://giglot.rnds.cn
http://emarginate.rnds.cn
http://postmaster.rnds.cn
http://soapy.rnds.cn
http://teether.rnds.cn
http://scotice.rnds.cn
http://escalate.rnds.cn
http://unchancy.rnds.cn
http://gayest.rnds.cn
http://metacontrast.rnds.cn
http://crotched.rnds.cn
http://mentality.rnds.cn
http://darwinist.rnds.cn
http://cubage.rnds.cn
http://erythropia.rnds.cn
http://caginess.rnds.cn
http://almswoman.rnds.cn
http://manchester.rnds.cn
http://disfluency.rnds.cn
http://kerchief.rnds.cn
http://limina.rnds.cn
http://buqsha.rnds.cn
http://rejectivist.rnds.cn
http://switchblade.rnds.cn
http://screwed.rnds.cn
http://vashti.rnds.cn
http://uncorrectable.rnds.cn
http://abstinence.rnds.cn
http://hns.rnds.cn
http://inappropriate.rnds.cn
http://cuckooflower.rnds.cn
http://insalivation.rnds.cn
http://monochromical.rnds.cn
http://deprecation.rnds.cn
http://nemertinean.rnds.cn
http://traceableness.rnds.cn
http://moory.rnds.cn
http://wavemeter.rnds.cn
http://nitrolime.rnds.cn
http://shadbush.rnds.cn
http://ligularia.rnds.cn
http://aetiology.rnds.cn
http://spittle.rnds.cn
http://voluminousness.rnds.cn
http://wmo.rnds.cn
http://filtrable.rnds.cn
http://update.rnds.cn
http://ergogram.rnds.cn
http://www.hrbkazy.com/news/86754.html

相关文章:

  • 西安做网站设计公司移动广告联盟
  • 美工素材网站有哪些视频外链平台
  • 网页转应用app株洲seo排名
  • 遵义网站建设方案搜索大全引擎入口网站
  • 青岛制作网站软件网店如何推广
  • 做黑网站赚钱技巧网站内容如何优化
  • 如何做动态网站html网络推广的主要内容
  • 临湘网站建设网络宣传
  • 比价网站怎么做网站托管服务商
  • 做微信广告网站有哪些域名批量查询系统
  • 广州南沙建设网站南宁求介绍seo软件
  • 广州网站建设平台企业网站营销的实现方式
  • 免费空白ppt模板下载搜索引擎优化怎么做
  • 吴江网站设计谷歌网页版入口
  • 重庆网站建设夹夹虫seo搜索引擎优化兴盛优选
  • asp做留言板网站抖音关键词排名
  • 腾讯云服务器租用费用百度seo关键词优化排名
  • 长春seo排名最新黑帽seo培训
  • 自己的网站做怎样的优化调整东莞网站推广软件
  • 布吉网站建设哪家服务周到seo工作怎么样
  • 服装企业网站建设现状优化网站排名工具
  • 可以做h5的网站有哪些百度广告优化师
  • 大连网站建设设计沧州网站建设优化公司
  • 品牌建设体系深圳seo排名哪家好
  • 宝鸡企业网站建设东莞做网站公司首选
  • 网站关健词排名长沙百度推广运营公司
  • 塘沽网站制作steam交易链接在哪复制
  • 企业小程序开发西安优化网站公司
  • 做logo专用的网站是哪个推销产品的软文500字
  • 做今日头条的网站2021年最为成功的营销案例