Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f25790d9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Unify logging implementations" am: 6d86c91c

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1348825

Change-Id: I0b441be6b5fb3c75ef5a6acfab44c14dc32aeef1
parents 8ccaca59 6d86c91c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@
#include "btif_util.h"
#include "btu.h"
#include "device/include/interop.h"
#include "log/log.h"
#include "osi/include/list.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"

+1 −12
Original line number Diff line number Diff line
@@ -28,10 +28,6 @@

#include <log/log.h>

/* When including headers from legacy stack, this log definitions collide with existing logging system. Remove once we
 * get rid of legacy stack. */
#ifndef LOG_VERBOSE

#ifdef FUZZ_TARGET
#define LOG_VERBOSE(...)
#define LOG_DEBUG(...)
@@ -45,8 +41,6 @@
#endif /* FUZZ_TARGET */
#define LOG_ERROR(fmt, args...) ALOGE("%s:%d %s: " fmt, __FILE__, __LINE__, __func__, ##args)

#endif /* LOG_VERBOSE*/

#else

/* syslog didn't work well here since we would be redefining LOG_DEBUG. */
@@ -54,10 +48,6 @@
#include <cstdio>
#include <ctime>

/* When including headers from legacy stack, this log definitions collide with existing logging system. Remove once we
 * get rid of legacy stack. */
#ifndef LOG_VERBOSE

#define LOGWRAPPER(fmt, args...)                                                                                      \
  do {                                                                                                                \
    auto now = std::chrono::system_clock::now();                                                                      \
@@ -88,8 +78,7 @@
    abort();                  \
  } while (false)
#define android_errorWriteLog(tag, subTag) LOG_ERROR("ERROR tag: 0x%x, sub_tag: %s", tag, subTag)

#endif /* LOG_VERBOE */
#define LOG_EVENT_INT(...)

#endif /* defined(OS_ANDROID) */

+1 −71
Original line number Diff line number Diff line
@@ -18,74 +18,4 @@

#pragma once

#ifndef LOG_TAG
#define LOG_TAG "bt"
#endif

/*
 * TODO(armansito): Work-around until we figure out a way to generate logs in a
 * platform-independent manner.
 */
#if defined(OS_GENERIC)

/* syslog didn't work well here since we would be redefining LOG_DEBUG. */
#include <stdio.h>

#define LOGWRAPPER(fmt, args...) \
  fprintf(stderr, "%s: " fmt "\n", LOG_TAG, ##args)

#define LOG_VERBOSE(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_DEBUG(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_INFO(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_WARN(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_ERROR(...) LOGWRAPPER(__VA_ARGS__)

#define LOG_EVENT_INT(...)

#else /* !defined(OS_GENERIC) */

#include <log/log.h>

/**
 * These log statements are effectively executing only ALOG(_________, LOG_TAG,
 * fmt,
 * ## args ).
 * fprintf is only to cause compilation error when LOG_TAG is not provided,
 * which breaks build on Linux (for OS_GENERIC).
 */

#if LOG_NDEBUG
#define LOG_VERBOSE(fmt, args...)                                   \
  do {                                                              \
    (true) ? ((int)0) : fprintf(stderr, "%s" fmt, LOG_TAG, ##args); \
  } while (0)
#else  // LOG_NDEBUG
#define LOG_VERBOSE(fmt, args...)                        \
  do {                                                   \
    (true) ? ALOG(LOG_VERBOSE, LOG_TAG, fmt, ##args)     \
           : fprintf(stderr, "%s" fmt, LOG_TAG, ##args); \
  } while (0)
#endif  // !LOG_NDEBUG

#define LOG_DEBUG(fmt, args...)                          \
  do {                                                   \
    (true) ? ALOG(LOG_DEBUG, LOG_TAG, fmt, ##args)       \
           : fprintf(stderr, "%s" fmt, LOG_TAG, ##args); \
  } while (0)
#define LOG_INFO(fmt, args...)                           \
  do {                                                   \
    (true) ? ALOG(LOG_INFO, LOG_TAG, fmt, ##args)        \
           : fprintf(stderr, "%s" fmt, LOG_TAG, ##args); \
  } while (0)
#define LOG_WARN(fmt, args...)                           \
  do {                                                   \
    (true) ? ALOG(LOG_WARN, LOG_TAG, fmt, ##args)        \
           : fprintf(stderr, "%s" fmt, LOG_TAG, ##args); \
  } while (0)
#define LOG_ERROR(fmt, args...)                          \
  do {                                                   \
    (true) ? ALOG(LOG_ERROR, LOG_TAG, fmt, ##args)       \
           : fprintf(stderr, "%s" fmt, LOG_TAG, ##args); \
  } while (0)

#endif /* defined(OS_GENERIC) */
#include "gd/os/log.h"