Annotation of nono/lib/logger.h, revision 1.1

1.1     ! root        1: //
        !             2: // nono
        !             3: // Copyright (C) 2017 [email protected]
        !             4: //
        !             5: 
        !             6: #pragma once
        !             7: 
        !             8: #include "fixedqueue.h"
        !             9: #include <mutex>
        !            10: 
        !            11: // ログキュー
        !            12: class Logger
        !            13: {
        !            14:  public:
        !            15:        Logger();
        !            16:        virtual ~Logger();
        !            17: 
        !            18:        // ログ書き込み
        !            19:        void Write(const char *);
        !            20: 
        !            21:        // ログ読み出し
        !            22:        bool Read(char *, int);
        !            23: 
        !            24:        // 標準出力にも出すかどうか
        !            25:        void UseStdout(bool val) { use_stdout = val; }
        !            26: 
        !            27:  private:
        !            28:        // パイプ
        !            29:        FixedQueue<uint8, 65536> pipe {};
        !            30: 
        !            31:        // 1行ずつの読み書き動作をアトミックにするための排他制御
        !            32:        std::mutex mtx {};
        !            33: 
        !            34:        // 標準出力にも出すかどうか
        !            35:        bool use_stdout = false;
        !            36: };
        !            37: 
        !            38: extern Logger *gLogger;
        !            39: extern void logger_init();

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.