| // Copyright 2011 Google Inc. All Rights Reserved. |
| // Author: qianzhang@google.com (ken Zhang) |
| |
| #ifndef _SAGELOG_H_ |
| #define _SAGELOG_H_ |
| |
| #include <assert.h> |
| |
| enum { |
| _LOG_TIMING = 0x01, // Timing and performance measurements |
| _LOG_TRACE = 0x02, // General step point call tracing |
| _LOG_MEMORY = 0x04, // Memory and object allocation/destruction |
| _LOG_LOCKING = 0x08, // Locking/unlocking of critical sections |
| _LOG_ERROR = 0x10, // Debug error notification |
| _LOG_CUSTOM1 = 0x20, |
| _LOG_CUSTOM2 = 0x40, |
| }; |
| |
| #define _MIN(x, y) ((x) > (y) ? (y) : (x)) |
| #define _MAX(x, y) ((x) > (y) ? (x) : (y)) |
| |
| #ifndef TEXT |
| #define TEXT(x) x |
| #endif |
| |
| #define snprintf snprintf |
| #define vsnprintf vsnprintf |
| |
| #ifndef lstrlen |
| #define lstrlen strlen |
| #endif |
| |
| #ifndef lstrcat |
| #define lstrcat strcat |
| #endif |
| |
| #ifndef ASSERT |
| #define ASSERT assert |
| #endif |
| |
| #define sage_log(x) _sagelog x |
| |
| void _sagelog(int type, int level, const char *cstr, ...); |
| void _flog_setup(char *filename, int enable); |
| char *_get_flog_path(void); |
| int _get_flog_state(void); |
| int _flog_check(void); |
| void _set_native_log(int level); |
| void _enable_native_log(void); |
| void _disable_native_log(void); |
| |
| #endif |