Last active
July 17, 2020 09:33
-
-
Save Nimrodda/2bd63e118d36276248e7 to your computer and use it in GitHub Desktop.
Simple log header with log levels for Android NDK library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <android/log.h> | |
#define LOG_VERBOSE 1 | |
#define LOG_DEBUG 2 | |
#define LOG_INFO 3 | |
#define LOG_WARN 4 | |
#define LOG_ERROR 5 | |
#ifndef LOG_LEVEL | |
#define LOGV(...) | |
#define LOGD(...) | |
#define LOGI(...) | |
#define LOGW(...) | |
#define LOGE(...) | |
#else | |
#if LOG_LEVEL <= LOG_VERBOSE | |
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__); | |
#endif | |
#if LOG_LEVEL <= LOG_DEBUG | |
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__); | |
#endif | |
#if LOG_LEVEL <= LOG_INFO | |
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__); | |
#endif | |
#if LOG_LEVEL <= LOG_WARN | |
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); | |
#endif | |
#if LOG_LEVEL <= LOG_ERROR | |
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); | |
#endif | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment