⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logger.h

📁 QT4的utils库源码包.解压后运行./configure配置,然后make.使用时在.pro文件中加入两行:LIBS+=-L$$(CPPLIBS)-lutils及INCLUDEPATH+=$$(C
💻 H
字号:
#ifndef LOGGER_H#define LOGGER_H#include "myexport.h"#include <QObject>#include <QMap>#include <QString>/** @short A simple object for communicating log messages   between objects/threads.      Inspired by the Logger class of the JDK 1.5,   (which was inspired by Apache log4j).    Loggers have a signal data(QString) which can be connected to   slots of other Qt objects - especially the  @ref LogWindow class, which is designed for it.  @author Alan Ezust  @see Command*/class UTILS_EXPORT Logger : public QObject {    Q_OBJECT    public:    /**       Factory named-singleton manager.       Creates or returns an existing Logger object       whose name is logname. if logname is "debug", installs a       QDebugHandler so that qDebug() messages go through this       log also.     */    static Logger* getLogger(QString logname = QString());    static void myDebugHandler( QtMsgType type, const char *msg );    public slots:        /** Send some info to this log */    void info(QString str);    signals:    /** Emitted whenever anyone writes anything to this log */    void data(const QString &str);    protected:    /**    You don't create them directly. Use Logger::getLogger(logname)    */    Logger(QString logname) {        setObjectName(logname);    }        private:    static QMap<QString, Logger*> sm_LogMap;//    static Logger* sm_Debug;};#endif        //  #ifndef LOGGER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -