static ModuleInfo modules[MAX_MODULE_CNT];
static int module_cnt = 0;
+static int default_level = XLOG_LEVEL_DEFAULT;
+
+static Bool dlog_enable;
extern void dLogWrapper (int loglevel, int is_module, const char * file, int line, const char * f, va_list args);
extern void kLogWrapper (int loglevel, int is_module, const char * file, int line, const char * f, va_list args);
kLogWrapper (loglevel, logoption, file, line, tmpBuf, args);
}
-
/* write to file */
if (loglevel >= XLOG_LEVEL_INFO)
{
else
snprintf(tmpBuf, BUF_LEN, "(%s) [%s]%s", ostr[loglevel], (name)?name:"", f);
- if (logoption & XLOG_OPTION_XORG)
+ if (!dlog_enable)
LogVWrite (1, tmpBuf, args);
+ else
+ {
+ dLogWrapper (loglevel, logoption, file, line, tmpBuf, args);
- dLogWrapper (loglevel, logoption, file, line, tmpBuf, args);
+ /* write to Xorg.0.log too */
+ if (logoption & XLOG_OPTION_XORG)
+ LogVWrite (1, tmpBuf, args);
+ }
}
/* write to terminal */
if (level < XLOG_LEVEL_0 || level > XLOG_LEVEL_4)
return FALSE;
+ if (module == XDBG_ALL_MODULE)
+ {
+ default_level = level;
+ for (i = 0; i < module_cnt; i++)
+ modules[i].loglevel = level;
+
+ return TRUE;
+ }
+
for (i = 0; i < module_cnt; i++)
{
if (module == modules[i].module)
return TRUE;
}
+API void
+xDbgLogEnableDlog (Bool enable)
+{
+ dlog_enable = (enable > 0) ? TRUE:FALSE;
+}
+
API void*
xDbgLog (unsigned int module, int logoption, const char * file, int line, const char * f, ...)
{
goto check_level;
}
- h= (ModuleInfo *)_LogInitModule (module, XLOG_LEVEL_DEFAULT);
+ h= (ModuleInfo *)_LogInitModule (module, default_level);
if(h == NULL)
return NULL;
if (!name)
return 0;
+ if (!strcasecmp (name, "all"))
+ return XDBG_ALL_MODULE;
+
len = strlen (name);
for (i = 0; i < len; i++)
{
XLOG_LEVEL_3,
XLOG_LEVEL_4,
XLOG_LEVEL_MAX,
- XLOG_LEVEL_DEFAULT = XLOG_LEVEL_3
+ XLOG_LEVEL_DEFAULT = XLOG_LEVEL_MAX
};
+#define XDBG_ALL_MODULE 0xFFFFFFFF
+
#define XLOG_LEVEL_DEBUG XLOG_LEVEL_0
#define XLOG_LEVEL_TRACE XLOG_LEVEL_1
#define XLOG_LEVEL_INFO XLOG_LEVEL_2
int xDbgLogEnumModules (LOG_ENUM_MODE mode, char *buf, int *remain);
int xDbgLogSetLevel (unsigned int module, int level);
+void xDbgLogEnableDlog (Bool enable);
void* xDbgLog (unsigned int module, int logoption, const char *file, int line, const char *f, ...);
// defines
#define XDBG_RETURN_IF_FAIL(cond) {if (!(cond)) { XDBG_ERROR (MXDBG, "'%s' failed.\n", #cond); return; }}
#define XDBG_RETURN_VAL_IF_FAIL(cond, val) {if (!(cond)) { XDBG_ERROR (MXDBG, "'%s' failed.\n", #cond); return val; }}
#define XDBG_RETURN_VAL_IF_ERRNO(cond, val, errno) {if (!(cond)) { XDBG_ERRNO (MXDBG, "'%s' failed.\n", #cond); return val; }}
-#define XDBG_GOTO_IF_FAIL(cond, dst) {if (!(cond)) { XDBG_ERROR ("'%s' failed.\n", #cond); goto dst; }}
+#define XDBG_GOTO_IF_FAIL(cond, dst) {if (!(cond)) { XDBG_ERROR (MXDBG, "'%s' failed.\n", #cond); goto dst; }}
#define XDBG_GOTO_IF_ERRNO(cond, dst, errno) {if (!(cond)) { XDBG_ERRNO (MXDBG, "'%s' failed.\n", #cond); goto dst; }}
#define XDBG_REPLY(fmt, ARG...) \
typedef struct _XDbgModule
{
+ Bool dlog;
char *log_path;
char *real_log_path;
char *evlog_path;
#include "xdbg_module_fpsdebug.h"
#include "xdbg_module_command.h"
+static void
+_CommandDLog (int pid, int argc, char **argv, char *reply, int *len, XDbgModule *pMod)
+{
+ int on;
+
+ if (argc != 3)
+ {
+ XDBG_REPLY ("Error : too few arguments\n");
+ return;
+ }
+
+ on = atoi (argv[2]);
+
+ xDbgLogEnableDlog (on);
+
+ XDBG_REPLY ("Success\n");
+}
+
static Bool
_CommandSetLogFile (int pid, char *path, char *reply, int *len, XDbgModule *pMod)
{
} command_proc[] =
{
{
+ "dlog", "to enable dlog", "[0-1]",
+ NULL, "[OFF:0/ON:1]",
+ _CommandDLog
+ },
+
+ {
"log_path", "to set log path", "[console/filepath]",
NULL, "[console/filepath]",
_CommandLogPath
/* Supported options */
typedef enum
{
+ OPTION_DLOG,
OPTION_LOG_PATH,
OPTION_EVLOG_PATH,
} ModuleOption;
static const OptionInfoRec module_options[] =
{
+ { OPTION_DLOG, "dlog", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_LOG_PATH, "log_path", OPTV_STRING, {0}, FALSE },
{ OPTION_EVLOG_PATH, "evlog_path", OPTV_STRING, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
xf86ProcessOptions (-1, pOpt, options);
+ /* dlog */
+ xf86GetOptValBool (options, OPTION_DLOG, &pMod->dlog);
+ XDBG_SLOG (MXDBG, "dlog: \"%s\"\n", (pMod->dlog)?"on":"off");
+ xDbgLogEnableDlog (pMod->dlog);
+
/* log_path */
log_path = xf86GetOptValString (options, OPTION_LOG_PATH);
if (log_path)