Logging tweaks to kill some kprintfs
This commit is contained in:
parent
f8deaed26a
commit
7dd6646ae3
@ -540,18 +540,24 @@ void map_vfs_directory(char * c) {
|
||||
void debug_print_vfs_tree_node(tree_node_t * node, size_t height) {
|
||||
/* End recursion on a blank entry */
|
||||
if (!node) return;
|
||||
char * tmp = malloc(512);
|
||||
memset(tmp, 0, 512);
|
||||
char * c = tmp;
|
||||
/* Indent output */
|
||||
for (uint32_t i = 0; i < height; ++i) { kprintf(" "); }
|
||||
for (uint32_t i = 0; i < height; ++i) {
|
||||
c += sprintf(c, " ");
|
||||
}
|
||||
/* Get the current process */
|
||||
struct vfs_entry * fnode = (struct vfs_entry *)node->value;
|
||||
/* Print the process name */
|
||||
if (fnode->file) {
|
||||
kprintf("%s → 0x%x (%s)", fnode->name, fnode->file, fnode->file->name);
|
||||
c += sprintf(c, "%s → 0x%x (%s)", fnode->name, fnode->file, fnode->file->name);
|
||||
} else {
|
||||
kprintf("%s → (empty)", fnode->name);
|
||||
c += sprintf(c, "%s → (empty)", fnode->name);
|
||||
}
|
||||
/* Linefeed */
|
||||
kprintf("\n");
|
||||
debug_print(NOTICE, "%s", tmp);
|
||||
free(tmp);
|
||||
foreach(child, node->children) {
|
||||
/* Recursively print the children */
|
||||
debug_print_vfs_tree_node(child->value, height + 1);
|
||||
|
@ -14,15 +14,14 @@
|
||||
log_type_t debug_level = NOTICE;
|
||||
|
||||
static char * c_messages[] = {
|
||||
"\033[1;34mINFO",
|
||||
"\033[1;35mNOTICE",
|
||||
"\033[1;33mWARNING",
|
||||
"\033[1;31mERROR",
|
||||
"\033[1;37;41mCRITICAL",
|
||||
"\033[1;31;44mINSANE"
|
||||
" \033[1;34mINFO\033[0m:",
|
||||
" \033[1;35mNOTICE\033[0m:",
|
||||
" \033[1;33mWARNING\033[0m:",
|
||||
" \033[1;31mERROR\033[0m:",
|
||||
" \033[1;37;41mCRITICAL\033[0m:",
|
||||
" \033[1;31;44mINSANE\033[0m:"
|
||||
};
|
||||
|
||||
|
||||
void _debug_print(char * title, int line_no, log_type_t level, char *fmt, ...) {
|
||||
if (level >= debug_level) {
|
||||
va_list args;
|
||||
@ -31,7 +30,14 @@ void _debug_print(char * title, int line_no, log_type_t level, char *fmt, ...) {
|
||||
vasprintf(buffer, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
kprintf("[%10d.%2d:%s:%d] %s\033[0m: %s\n", timer_ticks, timer_subticks, title, line_no, c_messages[level], buffer);
|
||||
char * type;
|
||||
if (level > INSANE) {
|
||||
type = "";
|
||||
} else {
|
||||
type = c_messages[level];
|
||||
}
|
||||
|
||||
kprintf("[%10d.%2d:%s:%d]%s %s\n", timer_ticks, timer_subticks, title, line_no, type, buffer);
|
||||
|
||||
}
|
||||
/* else ignore */
|
||||
|
@ -48,21 +48,27 @@ void initialize_process_tree(void) {
|
||||
void debug_print_process_tree_node(tree_node_t * node, size_t height) {
|
||||
/* End recursion on a blank entry */
|
||||
if (!node) return;
|
||||
char * tmp = malloc(512);
|
||||
memset(tmp, 0, 512);
|
||||
char * c = tmp;
|
||||
/* Indent output */
|
||||
for (uint32_t i = 0; i < height; ++i) { kprintf(" "); }
|
||||
for (uint32_t i = 0; i < height; ++i) {
|
||||
c += sprintf(c, " ");
|
||||
}
|
||||
/* Get the current process */
|
||||
process_t * proc = (process_t *)node->value;
|
||||
/* Print the process name */
|
||||
kprintf("%d.%d %s", proc->group ? proc->group : proc->id, proc->id, proc->name);
|
||||
c += sprintf(c, "%d.%d %s", proc->group ? proc->group : proc->id, proc->id, proc->name);
|
||||
if (proc->description) {
|
||||
/* And, if it has one, its description */
|
||||
kprintf(" %s", proc->description);
|
||||
c += sprintf(c, " %s", proc->description);
|
||||
}
|
||||
if (proc->finished) {
|
||||
kprintf(" [zombie]");
|
||||
c += sprintf(c, " [zombie]");
|
||||
}
|
||||
/* Linefeed */
|
||||
kprintf("\n");
|
||||
debug_print(NOTICE, "%s", tmp);
|
||||
free(tmp);
|
||||
foreach(child, node->children) {
|
||||
/* Recursively print the children */
|
||||
debug_print_process_tree_node(child->value, height + 1);
|
||||
@ -164,7 +170,7 @@ process_t * spawn_kidle(void) {
|
||||
idle->is_tasklet = 1;
|
||||
|
||||
idle->image.stack = (uintptr_t)malloc(KERNEL_STACK_SIZE) + KERNEL_STACK_SIZE;
|
||||
idle->thread.eip = &_kidle;
|
||||
idle->thread.eip = (uintptr_t)&_kidle;
|
||||
idle->thread.esp = idle->image.stack;
|
||||
idle->thread.ebp = idle->image.stack;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user