mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Module refactoring
This commit is contained in:
27
submodules/RMIntro/Sources/platform/common/platform_log.c
Executable file
27
submodules/RMIntro/Sources/platform/common/platform_log.c
Executable file
@@ -0,0 +1,27 @@
|
||||
#include "platform_log.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define LOG_VPRINTF(priority) printf("(" priority ") %s: ", tag); \
|
||||
va_list arg_ptr; \
|
||||
va_start(arg_ptr, fmt); \
|
||||
vprintf(fmt, arg_ptr); \
|
||||
va_end(arg_ptr); \
|
||||
printf("\n");
|
||||
|
||||
void _debug_log_v(const char *tag, const char *fmt, ...) {
|
||||
LOG_VPRINTF("VERBOSE");
|
||||
}
|
||||
|
||||
void _debug_log_d(const char *tag, const char *fmt, ...) {
|
||||
LOG_VPRINTF("DEBUG");
|
||||
}
|
||||
|
||||
void _debug_log_w(const char *tag, const char *fmt, ...) {
|
||||
LOG_VPRINTF("WARN");
|
||||
}
|
||||
|
||||
void _debug_log_e(const char *tag, const char *fmt, ...) {
|
||||
LOG_VPRINTF("ERROR");
|
||||
}
|
||||
22
submodules/RMIntro/Sources/platform/common/platform_log.h
Executable file
22
submodules/RMIntro/Sources/platform/common/platform_log.h
Executable file
@@ -0,0 +1,22 @@
|
||||
#include "platform_macros.h"
|
||||
|
||||
#ifndef LOGGING_ON
|
||||
#define LOGGING_ON 0
|
||||
#endif
|
||||
|
||||
void _debug_log_v(const char* tag, const char* text, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
void _debug_log_d(const char* tag, const char* text, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
void _debug_log_w(const char* tag, const char* text, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
void _debug_log_e(const char* tag, const char* text, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
|
||||
#define DEBUG_LOG_PRINT_V(tag, fmt, ...) do { if (LOGGING_ON) _debug_log_v(tag, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
#define DEBUG_LOG_PRINT_D(tag, fmt, ...) do { if (LOGGING_ON) _debug_log_d(tag, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
#define DEBUG_LOG_PRINT_W(tag, fmt, ...) do { if (LOGGING_ON) _debug_log_w(tag, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
#define DEBUG_LOG_PRINT_E(tag, fmt, ...) do { if (LOGGING_ON) _debug_log_e(tag, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
|
||||
#define DEBUG_LOG_WRITE_V(tag, text) DEBUG_LOG_PRINT_V(tag, "%s", text)
|
||||
#define DEBUG_LOG_WRITE_D(tag, text) DEBUG_LOG_PRINT_D(tag, "%s", text)
|
||||
#define DEBUG_LOG_WRITE_W(tag, text) DEBUG_LOG_PRINT_W(tag, "%s", text)
|
||||
#define DEBUG_LOG_WRITE_E(tag, text) DEBUG_LOG_PRINT_E(tag, "%s", text)
|
||||
|
||||
#define CRASH(e) DEBUG_LOG_WRITE_E("Assert", #e); __builtin_trap()
|
||||
5
submodules/RMIntro/Sources/platform/common/platform_macros.h
Executable file
5
submodules/RMIntro/Sources/platform/common/platform_macros.h
Executable file
@@ -0,0 +1,5 @@
|
||||
#if defined(__GNUC__)
|
||||
#define PRINTF_ATTRIBUTE(format_pos, arg_pos) __attribute__((format(printf, format_pos, arg_pos)))
|
||||
#else
|
||||
#define PRINTF_ATTRIBUTE(format_pos, arg_pos)
|
||||
#endif
|
||||
Reference in New Issue
Block a user