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

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

unix.superglobalmegacorp.com

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