class log_work {
private:
int log_id_ = 1;
int log_level_;
qnx_slog2() = default;
virtual ~qnx_slog2() { uninit(); }
public: inline static log_work& get_log() { static qnx_slog2 slog2_instance; return slog2_instance; } inline set_log_level(int level) { log_level_ = level;} bool init() {xxx}; void uninit() { slog2_reset(); } } int main() { //使用 log_work::get_log().init(); log_work::get_log().set_log_level(3);} 标签:log,自定义,level,int,work,c++,slog2,get,定义 From: https://www.cnblogs.com/huahuagongzi521/p/17390565.html