File:  [Isaki's NoNo m68k/m88k emulator] / nono / lib / logger.h
Revision 1.1.1.6 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:05:26 2026 UTC (3 months ago) by root
Branches: MAIN, Isaki
CVS tags: v024, v023, v022, v021, v020, HEAD
nono 1.0.0

//
// nono
// Copyright (C) 2020 nono project
// Licensed under nono-license.txt
//

//
// ログ
//

#pragma once

#include "fixedqueue.h"
#include <mutex>

class Logger final
{
 public:
	Logger();
	~Logger();

	// ログ書き込み
	void Write(const char *);

	// ログ読み出し
	bool Read(char *, int);

	// 標準出力にも出すかどうか
	void UseStdout(bool val) { use_stdout = val; }

 private:
	// パイプ
	FixedQueue<uint8, 65536> pipe {};

	// 1行ずつの読み書き動作をアトミックにするための排他制御
	std::mutex mtx {};

	// 標準出力にも出すかどうか
	bool use_stdout {};
};

unix.superglobalmegacorp.com

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