Prints log messages to outputs defined by PRINT_TO_* defs in Common.h. */
| 33 | |
| 34 | /** Prints log messages to outputs defined by PRINT_TO_* defs in Common.h. */ |
| 35 | VOID |
| 36 | EFIAPI |
| 37 | LogPrint(CHAR8 *Format, ...) |
| 38 | { |
| 39 | VA_LIST Marker; |
| 40 | UINTN DataWritten; |
| 41 | |
| 42 | if (gLogLineBuffer == NULL) { |
| 43 | gLogLineBuffer = AllocateRuntimePool(LOG_LINE_BUFFER_SIZE); |
| 44 | if (gLogLineBuffer == NULL) { |
| 45 | return; |
| 46 | } |
| 47 | *gLogLineBuffer='\0'; |
| 48 | } |
| 49 | |
| 50 | // Safety check to avoid some cases where LogPrint may be run recursively |
| 51 | if (*gLogLineBuffer != '\0') { |
| 52 | return; |
| 53 | } |
| 54 | *gLogLineBuffer = '!'; // Make buffer "dirty" to indicate we are using it |
| 55 | |
| 56 | // |
| 57 | // Print log to buffer |
| 58 | // |
| 59 | VA_START (Marker, Format); |
| 60 | DataWritten = AsciiVSPrint( |
| 61 | gLogLineBuffer, |
| 62 | LOG_LINE_BUFFER_SIZE, |
| 63 | Format, |
| 64 | Marker); |
| 65 | VA_END (Marker); |
| 66 | |
| 67 | if (DataWritten > 0) { |
| 68 | // |
| 69 | // Dispatch to various loggers |
| 70 | // |
| 71 | #if LOG_TO_SCREEN == 1 |
| 72 | #if CAPTURE_CONSOLE_OUTPUT >= 1 |
| 73 | // Print to screen only if not invoked from our OutputString() override |
| 74 | if (InBootServices && !InConsolePrint) { |
| 75 | InConsolePrint = TRUE; |
| 76 | AsciiPrint(gLogLineBuffer); |
| 77 | InConsolePrint = FALSE; |
| 78 | } |
| 79 | #else |
| 80 | if (InBootServices) { |
| 81 | AsciiPrint(gLogLineBuffer); |
| 82 | } |
| 83 | #endif |
| 84 | #endif |
| 85 | |
| 86 | #if LOG_TO_SERIAL >= 1 |
| 87 | #if (CAPTURE_CONSOLE_OUTPUT >= 1) && (LOG_TO_SERIAL == 1) |
| 88 | // Print to serial only if not invoked from our OutputString() override |
| 89 | if (!InBootServices || !InConsolePrint) { |
| 90 | DebugPrint(1, gLogLineBuffer); |
| 91 | } |
| 92 | #else |
nothing calls this directly
no test coverage detected