#pragma once #include <windows.h> #include <process.h> class CLogger { public: static CRITICAL_SECTION m_cs;//保证所有的对象都能访问到它 public: CLogger(); ~CLogger(); static int logger_to_file(const char* logfile);//加锁,放锁 static int logger(const char* fmt, ...); static int close_logger_file(); private: static int log_ref; static FILE* logfp; }; namespace Logger { int logger_to_file(const char* logfile); int logger(const char* fmt, ...); int close_logger_file(); int log_ref; FILE* logfp; }