Changeset 823 for Whitix/trunk/kernel/print.c
- Timestamp:
- 08/06/08 14:35:12 (4 years ago)
- Files:
-
- 1 modified
-
Whitix/trunk/kernel/print.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/trunk/kernel/print.c
r559 r823 17 17 */ 18 18 19 #include <config.h> 19 20 #include <module.h> 20 21 #include <stdarg.h> 21 22 #include <string.h> 22 23 #include <typedefs.h> 24 25 #include <i386/ioports.h> 23 26 24 27 static void (*ConsoleOutput)(char* message, int length); … … 31 34 SYMBOL_EXPORT(KeSetOutput); 32 35 36 int logLevelUnknown=1; 37 int currLogLevel=-1; 38 33 39 void KePrint(const char* message, ...) 34 40 { 35 char buf[2048]; 36 int length; 41 char buf[1024]; 42 char outputBuf[1024]; 43 char* start; 44 int length=0; 37 45 va_list args; 38 46 … … 41 49 va_end(args); 42 50 43 ConsoleOutput(buf, length); 51 length=0; 52 53 for (start=buf; *start; start++) 54 { 55 if (logLevelUnknown) 56 { 57 /* Parse the beginning of the message to find out the log level. */ 58 if (*start == '<') 59 { 60 currLogLevel=*(start+1)-'0'; 61 62 /* Skip past the closing > */ 63 start+=3; 64 }else 65 currLogLevel=1; 66 67 logLevelUnknown=0; 68 } 69 70 if (currLogLevel <= KERN_LOG_LEVEL) 71 outputBuf[length++]=*start; 72 73 if (*start == '\n') 74 logLevelUnknown=1; 75 } 76 77 outputBuf[length]='\0'; 78 79 ConsoleOutput(outputBuf, length); 44 80 } 45 81
