mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
changes to fit the codestyle
improved a comment removed unused code and imports
This commit is contained in:
parent
8cc266174d
commit
1eb3d7969e
3 changed files with 16 additions and 19 deletions
|
@ -20,7 +20,4 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
//#define vprint vprintf
|
||||
//#define print printf
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -30,21 +30,22 @@ void log_to_uart(const char *message) {
|
|||
/* TODO: add UART logging */
|
||||
}
|
||||
|
||||
void print_to_screen(ScreenLogLevel screenLogLevel, char *message) {
|
||||
void print_to_screen(ScreenLogLevel screen_log_level, char *message) {
|
||||
/* don't print to screen if below log level */
|
||||
if(g_screen_log_level == SCREEN_LOG_LEVEL_NONE || screenLogLevel > g_screen_log_level) return;
|
||||
if(screen_log_level > g_screen_log_level) return;
|
||||
|
||||
//video_puts(buf);
|
||||
printf(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* vprintk - logs a message to the console
|
||||
* vprintk - logs a message and prints it to screen based on its screen_log_level
|
||||
*
|
||||
* This text will not be colored or prefixed but logged to UART
|
||||
* If the level is below g_screen_log_level it will not be shown but logged to UART
|
||||
* This text will not be colored or prefixed
|
||||
* UART is TODO
|
||||
*/
|
||||
void vprint(ScreenLogLevel screenLogLevel, const char *fmt, va_list args)
|
||||
void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args)
|
||||
{
|
||||
char buf[PRINT_MESSAGE_MAX_LENGTH];
|
||||
vsnprintf(buf, PRINT_MESSAGE_MAX_LENGTH, fmt, args);
|
||||
|
@ -52,16 +53,16 @@ void vprint(ScreenLogLevel screenLogLevel, const char *fmt, va_list args)
|
|||
/* log to UART */
|
||||
log_to_uart(buf);
|
||||
|
||||
print_to_screen(screenLogLevel, buf);
|
||||
print_to_screen(screen_log_level, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* print - logs a message and prints it to screen based on its screenLogLevel
|
||||
* print - logs a message and prints it to screen based on its screen_log_level
|
||||
*
|
||||
* If the level is below g_screen_log_level it will not be shown but logged to UART
|
||||
* UART is TODO
|
||||
*/
|
||||
void print(ScreenLogLevel screenLogLevel, const char * fmt, ...)
|
||||
void print(ScreenLogLevel screen_log_level, const char * fmt, ...)
|
||||
{
|
||||
char typebuf[] = "[%s] %s";
|
||||
char buf[PRINT_MESSAGE_MAX_LENGTH] = {};
|
||||
|
@ -70,7 +71,7 @@ void print(ScreenLogLevel screenLogLevel, const char * fmt, ...)
|
|||
/* apply prefix and append message format */
|
||||
/* TODO: add coloring to the output */
|
||||
/* TODO: make splash disappear if level > MANDATORY */
|
||||
switch(screenLogLevel)
|
||||
switch(screen_log_level)
|
||||
{
|
||||
case SCREEN_LOG_LEVEL_ERROR:
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, typebuf, "ERROR", fmt);
|
||||
|
@ -100,5 +101,5 @@ void print(ScreenLogLevel screenLogLevel, const char * fmt, ...)
|
|||
/* log to UART */
|
||||
log_to_uart(message);
|
||||
|
||||
print_to_screen(screenLogLevel, message);
|
||||
print_to_screen(screen_log_level, message);
|
||||
}
|
|
@ -17,10 +17,9 @@
|
|||
#ifndef FUSEE_PRINT_H
|
||||
#define FUSEE_PRINT_H
|
||||
|
||||
#define PRINT_MESSAGE_MAX_LENGTH 512
|
||||
#define PRINT_MESSAGE_MAX_LENGTH 512
|
||||
|
||||
//#include <stdint.h>
|
||||
#include "../../fusee-primary/src/lib/vsprintf.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef enum {
|
||||
SCREEN_LOG_LEVEL_NONE = 0,
|
||||
|
@ -36,7 +35,7 @@ extern ScreenLogLevel g_screen_log_level;
|
|||
|
||||
void log_set_log_level(ScreenLogLevel screen_log_level);
|
||||
void log_to_uart(const char *message);
|
||||
void vprint(ScreenLogLevel screenLogLevel, const char *fmt, va_list args);
|
||||
void print(ScreenLogLevel screenLogLevel, const char* fmt, ...);
|
||||
void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args);
|
||||
void print(ScreenLogLevel screen_log_level, const char* fmt, ...);
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue