diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-12-18 16:30:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-18 16:30:02 +0100 |
| commit | b12b716a9e54c4f1892795a136d6ffeb088ff001 (patch) | |
| tree | 5888e4a77b207f24ccd9ad148d1c74e9c33400e9 /libpsn00b/psxetc/logging.c | |
| parent | 77306e187ef1a7ad5d3508ae9acb38edc5b68255 (diff) | |
| parent | a3359c0e7d85bf4752cda3b00892ecd5ef691077 (diff) | |
| download | psn00bsdk-b12b716a9e54c4f1892795a136d6ffeb088ff001.tar.gz | |
Merge pull request #68 from spicyjpeg/bugfix
Bugfixes, psxcd rewrite, psxgpu and CMake tweaks (v0.22)
Diffstat (limited to 'libpsn00b/psxetc/logging.c')
| -rw-r--r-- | libpsn00b/psxetc/logging.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/libpsn00b/psxetc/logging.c b/libpsn00b/psxetc/logging.c deleted file mode 100644 index 5199190..0000000 --- a/libpsn00b/psxetc/logging.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * PSn00bSDK internal debug logger - * (C) 2022 spicyjpeg - MPL licensed - * - * This file provides the (admittedly minimal) logging system used by all - * PSn00bSDK libraries. Log messages and warnings are issued using the - * _sdk_log() macro and collected into a buffer, whose contents can be flushed - * by calling _sdk_dump_log() (by default this is done by VSync()). Logging is - * only enabled in debug builds of libpsn00b. - */ - -#include <stddef.h> -#include <stdarg.h> -#include <stdio.h> -#include <psxapi.h> -#include <psxetc.h> - -#define LOG_BUFFER_SIZE 256 - -#ifndef NDEBUG - -/* Internal globals */ - -static char _log_buffer[LOG_BUFFER_SIZE]; -static size_t _log_buffer_length = 0; - -/* Internal logging API */ - -void _sdk_log_inner(const char *fmt, ...) { - va_list ap; - - va_start(ap, fmt); - _log_buffer_length += vsnprintf( - &_log_buffer[_log_buffer_length], - LOG_BUFFER_SIZE - _log_buffer_length, - fmt, - ap - ); - va_end(ap); -} - -void _sdk_dump_log_inner(void) { - if (!_log_buffer_length) - return; - - write(1, _log_buffer, _log_buffer_length); - _log_buffer_length = 0; -} - -#endif |
