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:
Volker Ruppert 2013-12-29 10:41:11 +00:00
parent acc4c6c2c8
commit fc4538a131
6 changed files with 13 additions and 15 deletions

View File

@ -291,11 +291,11 @@ public:
}
} logfunc_t;
#define BX_LOGPREFIX_SIZE 51
#define BX_LOGPREFIX_LEN 20
class BOCHSAPI iofunctions {
int magic;
char logprefix[BX_LOGPREFIX_SIZE];
char logprefix[BX_LOGPREFIX_LEN + 1];
FILE *logfd;
class logfunctions *log;
void init(void);

View File

@ -1583,7 +1583,7 @@ void bx_init_options()
"prefix",
"Log output prefix",
"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] ");
path = new bx_param_filename_c(menu,

View File

@ -255,7 +255,7 @@ bx_svga_cirrus_c::~bx_svga_cirrus_c()
void bx_svga_cirrus_c::init_vga_extension(void)
{
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.
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);

View File

@ -153,7 +153,7 @@ void libvoodoo_LTX_plugin_fini(void)
bx_voodoo_c::bx_voodoo_c()
{
put("voodoo", "SST-1");
put("voodoo", "VOODOO");
s.mode_change_timer_id = BX_NULL_TIMER_HANDLE;
s.update_timer_id = BX_NULL_TIMER_HANDLE;
}

View File

@ -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)
{
char c=' ', *s;
char c = ' ', *s;
assert(magic==MAGIC_LOGNUM);
assert(this != NULL);
assert(logfd != NULL);
@ -189,9 +189,9 @@ void iofunctions::out(int level, const char *prefix, const char *fmt, va_list ap
default: break;
}
s=logprefix;
while(*s) {
switch(*s) {
s = logprefix;
while (*s) {
switch (*s) {
case '%':
if(*(s+1)) s++;
else break;
@ -362,7 +362,7 @@ void logfunctions::info(const char *fmt, ...)
assert(logio != NULL);
if(!onoff[LOGLEV_INFO]) return;
if (!onoff[LOGLEV_INFO]) return;
va_start(ap, fmt);
logio->out(LOGLEV_INFO, prefix, fmt, ap);

View File

@ -536,17 +536,15 @@ plugin_startup(void)
pluginRegisterTimer = builtinRegisterTimer;
pluginActivateTimer = builtinActivateTimer;
#if BX_PLUGINS
pluginlog = new logfunctions();
pluginlog->put("PLGIN");
#if !defined(_MSC_VER)
pluginlog->put("PLUGIN");
#if BX_PLUGINS && !defined(_MSC_VER)
int status = lt_dlinit();
if (status != 0) {
BX_ERROR(("initialization error in ltdl library (for loading plugins)"));
BX_PANIC(("error message was: %s", lt_dlerror()));
}
#endif
#endif
}