1 /* 2 * Copyright 2017 Google, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <stdint.h> 20 21 #include "flutter/fml/logging.h" 22 23 #if defined(_WIN32) 24 // Conflicts with macro on Windows. 25 #undef ERROR 26 #endif 27 28 #ifndef LOG_ALWAYS_FATAL_IF 29 #define LOG_ALWAYS_FATAL_IF(cond, ...) \ 30 ((cond) ? (FML_LOG(FATAL) << #cond) : (void)0) 31 #endif 32 33 #ifndef LOG_ALWAYS_FATAL 34 #define LOG_ALWAYS_FATAL(...) FML_LOG(FATAL) 35 #endif 36 37 #ifndef LOG_ASSERT 38 #define LOG_ASSERT(cond, ...) FML_CHECK(cond) 39 #define ALOG_ASSERT LOG_ASSERT 40 #endif 41 42 #ifndef ALOGD 43 #define ALOGD(message, ...) FML_DLOG(INFO) << (message) 44 #endif 45 46 #ifndef ALOGW 47 #define ALOGW(message, ...) FML_LOG(WARNING) << (message) 48 #endif 49 50 #ifndef ALOGE 51 #define ALOGE(message, ...) FML_LOG(ERROR) << (message) 52 #endif 53 54 #define android_errorWriteLog(tag, subTag) \ 55 __android_log_error_write(tag, subTag, -1, NULL, 0) 56 #define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \ 57 __android_log_error_write(tag, subTag, uid, data, dataLen) 58 int __android_log_error_write(int tag, 59 const char* subTag, 60 int32_t uid, 61 const char* data, 62 uint32_t dataLen); 63