| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*
- * Copyright (c) 2013 Hugh Bailey <[email protected]>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
- #pragma once
- #include <wctype.h>
- #include <stdarg.h>
- #include "c99defs.h"
- /*
- * Just contains logging/crash related stuff
- */
- #ifdef __cplusplus
- extern "C" {
- #endif
- enum log_type {
- LOG_DEBUG,
- LOG_INFO,
- LOG_WARNING,
- LOG_ERROR
- };
- EXPORT void base_set_log_handler(
- void (*handler)(enum log_type, const char *, va_list));
- EXPORT void base_set_crash_handler(void (*handler)(const char *, va_list));
- #ifndef _MSC_VER
- #define PRINTFATTR(f, a) __attribute__((__format__(__printf__, f, a)))
- #else
- #define PRINTFATTR(f, a)
- #endif
- PRINTFATTR(2, 3)
- EXPORT void blog(enum log_type type, const char *format, ...);
- PRINTFATTR(1, 2)
- EXPORT void bcrash(const char *format, ...);
- #undef PRINTFATTR
- #ifdef __cplusplus
- }
- #endif
|