123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
- /*
- * Copyright (c) 2018, Chips&Media
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- #ifndef _LOG_H_
- #define _LOG_H_
- #ifdef USE_FEEDING_METHOD_BUFFER
- #include "codaj12/jpuapi/jputypes.h"
- #else
- #include "jputypes.h"
- #endif
- enum
- {
- ERR=0,
- WARN,
- TRACE,
- INFO,
- DEBUG,
- MAX_LOG_LEVEL
- };
- enum
- {
- LOG_HAS_DAY_NAME = 1, /**< Include day name [default: no] */
- LOG_HAS_YEAR = 2, /**< Include year digit [no] */
- LOG_HAS_MONTH = 4, /**< Include month [no] */
- LOG_HAS_DAY_OF_MON = 8, /**< Include day of month [no] */
- LOG_HAS_TIME = 16, /**< Include time [yes] */
- LOG_HAS_MICRO_SEC = 32, /**< Include microseconds [yes] */
- LOG_HAS_FILE = 64, /**< Include sender in the log [yes] */
- LOG_HAS_NEWLINE = 128, /**< Terminate each call with newline [yes] */
- LOG_HAS_CR = 256, /**< Include carriage return [no] */
- LOG_HAS_SPACE = 512, /**< Include two spaces before log [yes] */
- LOG_HAS_COLOR = 1024, /**< Colorize logs [yes on win32] */
- LOG_HAS_LEVEL_TEXT = 2048 /**< Include level text string [no] */
- };
- enum {
- TERM_COLOR_R = 2, /**< Red */
- TERM_COLOR_G = 4, /**< Green */
- TERM_COLOR_B = 1, /**< Blue. */
- TERM_COLOR_BRIGHT = 8 /**< Bright mask. */
- };
- #define MAX_PRINT_LENGTH 512
- #ifdef ANDROID
- #include <utils/Log.h>
- #undef LOG_NDEBUG
- #define LOG_NDEBUG 0
- #undef LOG_TAG
- #define LOG_TAG "JPUAPI"
- #endif
- #define JLOG LogMsg
- #define LOG_ENABLE_FILE SetLogDecor(GetLogDecor()|LOG_HAS_FILE);
- #if defined (__cplusplus)
- extern "C" {
- #endif
- BOOL InitLog(const char* path);
- void DeInitLog();
- void SetMaxLogLevel(int level);
- int GetMaxLogLevel();
- void SetLogColor(int level, int color);
- int GetLogColor(int level);
- void SetLogDecor(int decor);
- int GetLogDecor();
- void LogMsg(int level, const char *format, ...);
- void timer_start();
- void timer_stop();
- double timer_elapsed_us();
- double timer_elapsed_ms();
- int timer_is_valid();
- double timer_frequency();
- #if defined (__cplusplus)
- }
- #endif
- #endif //#ifndef _LOG_H_
|