ctr_Repair/trunk/ConsoleDataMigration/sources/common/CommonLogger.h
N2614 f3ca6f34b1 ディレクトリ移動
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@216 385bec56-5757-e545-9c3a-d8741f4650f1
2011-04-22 04:58:07 +00:00

85 lines
2.8 KiB
C++

/*---------------------------------------------------------------------------*
Project: Horizon
File: CommonLogger.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Rev$
*---------------------------------------------------------------------------*/
#ifndef COMMONLOGGER_H_
#define COMMONLOGGER_H_
#include <nn.h>
#include "demo.h"
#include "SdLogger.h"
#include "LogConsole.h"
#define COMMON_LOGGER( ... ) (void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__)
#define COMMON_LOGGER_RESULT(result, func) \
(void)nn::dbg::PrintResult(result); \
(void)common::Logger::GetLoggerInstance()->PrintResult("Func = %s\n", func); \
(void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \
#define COMMON_LOGGER_RESULT_WITH_LINE(result, line, func) \
(void)nn::dbg::detail::Printf("%s\n", func); \
(void)nn::dbg::detail::Printf("%d\n", line); \
(void)nn::dbg::PrintResult(result); \
(void)common::Logger::GetLoggerInstance()->PrintResult("Func = %s\n", func); \
(void)common::Logger::GetLoggerInstance()->PrintResult("line = %d\n", line); \
(void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \
#define COMMON_LOGGER_RESULT_IF_FAILED(result) \
if(result.IsFailure()) \
{ \
COMMON_LOGGER_RESULT(result, __func__); \
} \
#define COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result) \
if(result.IsFailure()) \
{ \
COMMON_LOGGER_RESULT_WITH_LINE(result, __LINE__, __func__); \
} \
namespace common
{
namespace Logger
{
class CommonLogger
{
public:
CommonLogger();
~CommonLogger();
void Initialize(u32 width, u32 height, u32 maxLine, demo::RenderSystemDrawing* renderSystem);
void Finalize();
void Print(const char* fmt, ...);
void PrintResult(const char* fmt, ...);
void ClearLog();
void ScrollUp();
void ScrollDown();
void ScrollToBegin();
void ScrollToEnd();
void DrawConsole();
private:
nn::os::CriticalSection m_CriticalSection;
};
CommonLogger* GetLoggerInstance();
}
}
#endif /* COMMONLOGGER_H_ */