-
Notifications
You must be signed in to change notification settings - Fork 5
/
Logging.cpp
46 lines (35 loc) · 1.21 KB
/
Logging.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// *****************************************************************************
// include emulator headers
#include "Logging.hpp"
#include "Globals.hpp"
// include C/C++ headers
#include <iostream> // [ C++ STL ] I/O Streams
#include <stdexcept> // [ C++ STL ] Exceptions
// declare used namespaces
using namespace std;
// *****************************************************************************
// =============================================================================
// BASIC LOGGING FUNCTIONS
// =============================================================================
void LOG( const std::string& Message )
{
if( log_cb )
log_cb( RETRO_LOG_INFO, "%s\n", Message.c_str() );
else
{
cout << Message << endl;
if( !cout.bad() ) cout.flush();
}
}
// -----------------------------------------------------------------------------
[[ noreturn ]] void THROW( const std::string& Message )
{
if( log_cb )
log_cb( RETRO_LOG_ERROR, "%s\n", Message.c_str() );
else
{
cerr << "ERROR: " << Message << endl;
if( !cerr.bad() ) cout.flush();
}
throw runtime_error( Message );
}