31 #include <boost/format.hpp> 36 #include <android/log.h> 40 #define DEFAULT_LOGFILE "gnash-dbg.log" 44 #define _(String) gettext (String) 45 #define N_(String) gettext_noop (String) 49 #define LOG_ONCE(x) { \ 50 static bool warned = false; \ 51 if (!warned) { warned = true; x; } \ 57 #define __FUNCDNAME__ __FUNCTION__ 67 static LogFile& getDefaultInstance();
93 void log(
const std::string& label,
const std::string& msg);
100 void log(
const std::string& msg);
120 void setLogFilename(
const std::string&
fname);
168 void setWriteDisk(
bool b);
174 typedef void (*logListener)(
const std::string&
s);
186 bool openLog(
const std::string& filespec);
198 bool openLogIfNeeded();
207 std::ofstream _outstream;
229 std::string _filespec;
231 std::string _logFilename;
233 logListener _listener;
249 template <
typename FuncType>
256 template<
typename FuncType,
typename Arg,
typename... Args>
258 log_impl(boost::format& fmt, FuncType processFunc, Arg arg, Args... args)
261 log_impl(fmt, processFunc, args...);
264 template<
typename StringType,
typename FuncType,
typename... Args>
266 log_impl(StringType msg, FuncType func, Args... args)
268 boost::format fmt(msg);
269 using namespace boost::io;
270 fmt.exceptions(all_error_bits ^ (too_many_args_bit |
272 bad_format_string_bit));
276 template<
typename StringType,
typename... Args>
279 log_impl(msg, processLog_network, args...);
282 template<
typename StringType,
typename... Args>
285 log_impl(msg, processLog_error, args...);
288 template<
typename StringType,
typename... Args>
291 log_impl(msg, processLog_unimpl, args...);
294 template<
typename StringType,
typename... Args>
297 log_impl(msg, processLog_trace, args...);
300 template<
typename StringType,
typename... Args>
303 log_impl(msg, processLog_debug, args...);
306 template<
typename StringType,
typename... Args>
309 log_impl(msg, processLog_action, args...);
312 template<
typename StringType,
typename... Args>
315 log_impl(msg, processLog_parse, args...);
318 template<
typename StringType,
typename... Args>
321 log_impl(msg, processLog_security, args...);
324 template<
typename StringType,
typename... Args>
327 log_impl(msg, processLog_swferror, args...);
330 template<
typename StringType,
typename... Args>
333 log_impl(msg, processLog_aserror, args...);
336 template<
typename StringType,
typename... Args>
337 inline void log_abc(StringType msg, Args... args)
339 log_impl(msg, processLog_abc, args...);
353 #ifndef VERBOSE_PARSE 354 #define VERBOSE_PARSE 1 358 #ifndef VERBOSE_ACTION 359 #define VERBOSE_ACTION 1 363 #ifndef VERBOSE_ASCODING_ERRORS 364 #define VERBOSE_ASCODING_ERRORS 1 368 #ifndef VERBOSE_MALFORMED_SWF 369 #define VERBOSE_MALFORMED_SWF 1 373 #ifndef VERBOSE_NETWORKING 374 #define VERBOSE_NETWORKING 1 378 #define IF_VERBOSE_PARSE(x) do { if ( LogFile::getDefaultInstance().getParserDump() ) { x; } } while (0); 380 #define IF_VERBOSE_PARSE(x) 384 #define IF_VERBOSE_ACTION(x) do { if ( LogFile::getDefaultInstance().getActionDump() ) { x; } } while (0); 386 #define IF_VERBOSE_ACTION(x) 390 #define IF_VERBOSE_NETWORK(x) do { if ( LogFile::getDefaultInstance().getNetwork() ) { x; } } while (0); 392 #define IF_VERBOSE_NETWORK(x) 395 #if VERBOSE_ASCODING_ERRORS 397 #define IF_VERBOSE_ASCODING_ERRORS(x) { if ( gnash::RcInitFile::getDefaultInstance().showASCodingErrors() ) { x; } } 399 #define IF_VERBOSE_ASCODING_ERRORS(x) 402 #if VERBOSE_MALFORMED_SWF 404 #define IF_VERBOSE_MALFORMED_SWF(x) { if ( gnash::RcInitFile::getDefaultInstance().showMalformedSWFErrors() ) { x; } } 406 #define IF_VERBOSE_MALFORMED_SWF(x) 433 #ifndef HAVE_FUNCTION 435 #define dummystr(x) # x 436 #define dummyestr(x) dummystr(x) 437 #define __FUNCTION__ __FILE__ ":" dummyestr(__LINE__) 439 #define __FUNCTION__ __func__ 443 #ifndef HAVE_PRETTY_FUNCTION 444 #define __PRETTY_FUNCTION__ __FUNCTION__ 447 #if defined(__cplusplus) && defined(__GNUC__) 448 #define GNASH_REPORT_FUNCTION \ 449 const gnash::HostFunctionReport hfr(__PRETTY_FUNCTION__) 450 #define GNASH_REPORT_RETURN 452 #define GNASH_REPORT_FUNCTION \ 453 gnash::log_debug("entering") 455 #define GNASH_REPORT_RETURN \ 456 gnash::log_debug("returning") 461 #endif // GNASH_LOG_H void setActionDump(int x)
Definition: log.h:135
void log_aserror(StringType msg, Args...args)
Definition: log.h:331
void setVerbosity(int x)
Definition: log.h:127
HostFunctionReport()
Definition: log.h:414
void setParserDump(int x)
Definition: log.h:151
fname
Definition: extensions/fileio/test.as:27
void log_error(StringType msg, Args...args)
Definition: log.h:283
void processLog_action(const boost::format &fmt)
Definition: log.cpp:231
bool getWriteDisk() const
Definition: log.h:170
void registerLogCallback(logListener l)
Definition: log.h:176
void log_network(StringType msg, Args...args)
Definition: log.h:277
Definition: GnashKey.h:158
void log_unimpl(StringType msg, Args...args)
Definition: log.h:289
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
int getVerbosity() const
Definition: log.h:131
std::string hexify(const unsigned char *p, size_t length, bool ascii)
Convert a sequence of bytes to hex or ascii format.
Definition: log.cpp:48
~HostFunctionReport()
Definition: log.h:426
int getNetwork() const
Definition: log.h:147
void processLog_abc(const boost::format &fmt)
Definition: log.cpp:142
void processLog_trace(const boost::format &fmt)
Definition: log.cpp:119
void setNetwork(int x)
Definition: log.h:139
void processLog_network(const boost::format &fmt)
Definition: log.cpp:165
void log_debug(StringType msg, Args...args)
Definition: log.h:301
void processLog_error(const boost::format &fmt)
Definition: log.cpp:176
void processLog_security(const boost::format &fmt)
Definition: log.cpp:198
void setVerbosity()
Definition: log.h:123
Definition: klash_part.cpp:329
void processLog_parse(const boost::format &fmt)
Definition: log.cpp:154
Definition: GnashKey.h:148
#define DSOEXPORT
Definition: dsodefs.h:55
int getParserDump() const
Definition: log.h:155
x
Definition: extensions/fileio/test.as:62
void log_trace(StringType msg, Args...args)
Definition: log.h:295
void log_security(StringType msg, Args...args)
Definition: log.h:319
void processLog_aserror(const boost::format &fmt)
Definition: log.cpp:220
FileState
Definition: log.h:78
void log_impl(boost::format &fmt, FuncType func)
Definition: log.h:251
LogLevel
Definition: log.h:71
void log_parse(StringType msg, Args...args)
Definition: log.h:313
void setStamp(bool b)
Definition: log.h:159
int getActionDump() const
Definition: log.h:143
Definition: GnashKey.h:165
void log_abc(StringType msg, Args...args)
Definition: log.h:337
bool getStamp() const
Definition: log.h:163
void log_action(StringType msg, Args...args)
Definition: log.h:307
void processLog_debug(const boost::format &fmt)
Definition: log.cpp:130
function log(msg)
Definition: plugin/test/baseuri/sub/test.as:6
void log_swferror(StringType msg, Args...args)
Definition: log.h:325
void processLog_swferror(const boost::format &fmt)
Definition: log.cpp:209
HostFunctionReport(const char *func)
Definition: log.h:418
void processLog_unimpl(const boost::format &fmt)
Definition: log.cpp:187