/*---------------------------------------------------------------------------* 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 #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_ */