diff --git a/include/glacier_log.h b/include/glacier_log.h index 7a9851e..3145ede 100644 --- a/include/glacier_log.h +++ b/include/glacier_log.h @@ -76,4 +76,24 @@ void warnlog(char MSG[]); void errlog(char MSG[]); +/**************************************************************************************************************/ + +/* + * successlog + * + * DESCRIPTION: Successlog outputs a stylized success message. It follows Glacier's uniform CLI style. + * PARAMETERS: + * char MSG[] -> The message to output + * RETURN VALUES: + * None. + * CAVEATS: + * * Cannot output variables. If you must output variables, use printf instead. + * * A NEWLINE ('\n') character is implied, therefore putting one at the end of + * a string is not needed. + * EXAMPLE: + * successlog("This is a success message."); + */ + +void successlog(char MSG[]); + #endif diff --git a/libglacier.c b/libglacier.c index bd384e6..7ad09bd 100644 --- a/libglacier.c +++ b/libglacier.c @@ -103,6 +103,28 @@ errlog(char MSG[]) return; } +/* + * successlog + * + * DESCRIPTION: Output a stylized success message. + * PARAMETERS: char MSG[] + * + */ + +void +successlog(char MSG[]) +{ + const wchar_t w_check = 0x2713; + setlocale(LC_TYPE, ""); + + if (MSG == NULL) { + return; + } + + printf(COL_GREEN "[%lc]" COL_RESET " %s\n", w_check, MSG); + return; +} + /* * runtime_exists *