Some fixes / improvements in logging system
- fixed pluginlog init in non-plugin mode - reduced logprefix length limit and use it for the related string parameter - increase the device prefix size to 6 - TODO: change some more device prefixes
This commit is contained in:
parent
acc4c6c2c8
commit
fc4538a131
@ -291,11 +291,11 @@ public:
|
|||||||
}
|
}
|
||||||
} logfunc_t;
|
} logfunc_t;
|
||||||
|
|
||||||
#define BX_LOGPREFIX_SIZE 51
|
#define BX_LOGPREFIX_LEN 20
|
||||||
|
|
||||||
class BOCHSAPI iofunctions {
|
class BOCHSAPI iofunctions {
|
||||||
int magic;
|
int magic;
|
||||||
char logprefix[BX_LOGPREFIX_SIZE];
|
char logprefix[BX_LOGPREFIX_LEN + 1];
|
||||||
FILE *logfd;
|
FILE *logfd;
|
||||||
class logfunctions *log;
|
class logfunctions *log;
|
||||||
void init(void);
|
void init(void);
|
||||||
|
@ -1583,7 +1583,7 @@ void bx_init_options()
|
|||||||
"prefix",
|
"prefix",
|
||||||
"Log output prefix",
|
"Log output prefix",
|
||||||
"Prefix prepended to log output",
|
"Prefix prepended to log output",
|
||||||
"%t%e%d", BX_PATHNAME_LEN);
|
"%t%e%d", BX_LOGPREFIX_LEN);
|
||||||
prefix->set_ask_format("Enter log prefix: [%s] ");
|
prefix->set_ask_format("Enter log prefix: [%s] ");
|
||||||
|
|
||||||
path = new bx_param_filename_c(menu,
|
path = new bx_param_filename_c(menu,
|
||||||
|
@ -255,7 +255,7 @@ bx_svga_cirrus_c::~bx_svga_cirrus_c()
|
|||||||
void bx_svga_cirrus_c::init_vga_extension(void)
|
void bx_svga_cirrus_c::init_vga_extension(void)
|
||||||
{
|
{
|
||||||
if (!strcmp(SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr(), "cirrus")) {
|
if (!strcmp(SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr(), "cirrus")) {
|
||||||
BX_CIRRUS_THIS put("cirrus", "CLVGA");
|
BX_CIRRUS_THIS put("cirrus", "CIRRUS");
|
||||||
// initialize SVGA stuffs.
|
// initialize SVGA stuffs.
|
||||||
BX_CIRRUS_THIS bx_vgacore_c::init_iohandlers(svga_read_handler, svga_write_handler);
|
BX_CIRRUS_THIS bx_vgacore_c::init_iohandlers(svga_read_handler, svga_write_handler);
|
||||||
BX_CIRRUS_THIS bx_vgacore_c::init_systemtimer(svga_timer_handler, svga_param_handler);
|
BX_CIRRUS_THIS bx_vgacore_c::init_systemtimer(svga_timer_handler, svga_param_handler);
|
||||||
|
@ -153,7 +153,7 @@ void libvoodoo_LTX_plugin_fini(void)
|
|||||||
|
|
||||||
bx_voodoo_c::bx_voodoo_c()
|
bx_voodoo_c::bx_voodoo_c()
|
||||||
{
|
{
|
||||||
put("voodoo", "SST-1");
|
put("voodoo", "VOODOO");
|
||||||
s.mode_change_timer_id = BX_NULL_TIMER_HANDLE;
|
s.mode_change_timer_id = BX_NULL_TIMER_HANDLE;
|
||||||
s.update_timer_id = BX_NULL_TIMER_HANDLE;
|
s.update_timer_id = BX_NULL_TIMER_HANDLE;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void iofunctions::set_log_prefix(const char* prefix)
|
|||||||
|
|
||||||
void iofunctions::out(int level, const char *prefix, const char *fmt, va_list ap)
|
void iofunctions::out(int level, const char *prefix, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
char c=' ', *s;
|
char c = ' ', *s;
|
||||||
assert(magic==MAGIC_LOGNUM);
|
assert(magic==MAGIC_LOGNUM);
|
||||||
assert(this != NULL);
|
assert(this != NULL);
|
||||||
assert(logfd != NULL);
|
assert(logfd != NULL);
|
||||||
@ -189,9 +189,9 @@ void iofunctions::out(int level, const char *prefix, const char *fmt, va_list ap
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
s=logprefix;
|
s = logprefix;
|
||||||
while(*s) {
|
while (*s) {
|
||||||
switch(*s) {
|
switch (*s) {
|
||||||
case '%':
|
case '%':
|
||||||
if(*(s+1)) s++;
|
if(*(s+1)) s++;
|
||||||
else break;
|
else break;
|
||||||
@ -328,7 +328,7 @@ void logfunctions::put(const char *p)
|
|||||||
|
|
||||||
void logfunctions::put(const char *n, const char *p)
|
void logfunctions::put(const char *n, const char *p)
|
||||||
{
|
{
|
||||||
char *tmpbuf=strdup("[ ]"); // if we ever have more than 32 chars,
|
char *tmpbuf=strdup("[ ]"); // if we ever have more than 32 chars,
|
||||||
// we need to rethink this
|
// we need to rethink this
|
||||||
|
|
||||||
if (tmpbuf == NULL)
|
if (tmpbuf == NULL)
|
||||||
@ -362,7 +362,7 @@ void logfunctions::info(const char *fmt, ...)
|
|||||||
|
|
||||||
assert(logio != NULL);
|
assert(logio != NULL);
|
||||||
|
|
||||||
if(!onoff[LOGLEV_INFO]) return;
|
if (!onoff[LOGLEV_INFO]) return;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
logio->out(LOGLEV_INFO, prefix, fmt, ap);
|
logio->out(LOGLEV_INFO, prefix, fmt, ap);
|
||||||
|
@ -536,17 +536,15 @@ plugin_startup(void)
|
|||||||
pluginRegisterTimer = builtinRegisterTimer;
|
pluginRegisterTimer = builtinRegisterTimer;
|
||||||
pluginActivateTimer = builtinActivateTimer;
|
pluginActivateTimer = builtinActivateTimer;
|
||||||
|
|
||||||
#if BX_PLUGINS
|
|
||||||
pluginlog = new logfunctions();
|
pluginlog = new logfunctions();
|
||||||
pluginlog->put("PLGIN");
|
pluginlog->put("PLUGIN");
|
||||||
#if !defined(_MSC_VER)
|
#if BX_PLUGINS && !defined(_MSC_VER)
|
||||||
int status = lt_dlinit();
|
int status = lt_dlinit();
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
BX_ERROR(("initialization error in ltdl library (for loading plugins)"));
|
BX_ERROR(("initialization error in ltdl library (for loading plugins)"));
|
||||||
BX_PANIC(("error message was: %s", lt_dlerror()));
|
BX_PANIC(("error message was: %s", lt_dlerror()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user