ipfs-chromium
Loading...
Searching...
No Matches
log_macros.h
1#ifndef IPFS_LOG_MACROS_H_
2#define IPFS_LOG_MACROS_H_
3
4#include <string_view>
5
6#if __has_include("base/logging.h") //In Chromium
7
8#include "base/logging.h"
9#include "base/check_op.h"
10
11#else // Not in Chromium
12
13#include <ipfs_client/logger.h>
14
15#include <google/protobuf/stubs/logging.h>
16
17#define DCHECK_EQ GOOGLE_DCHECK_EQ
18#define DCHECK_GT GOOGLE_DCHECK_GT
19#define DCHECK GOOGLE_DCHECK
20#define LOG GOOGLE_LOG
21
22#define VLOG(X) \
23 ::google::protobuf::internal::LogFinisher() = \
24 ::google::protobuf::internal::LogMessage( \
25 static_cast<::google::protobuf::LogLevel>( \
26 ::google::protobuf::LOGLEVEL_INFO - ( X ) ), \
27 __FILE__, __LINE__)
28
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Wunused-variable"
31namespace {
32static bool const is_logging_initialized = ::ipfs::log::IsInitialized();
33} // namespace
34#pragma GCC diagnostic pop
35
36#endif //Chromium in-tree check
37
38#define L_VAR(X) LOG(INFO) << "VAR " << #X << "='" << (X) << '\'';
39
40#endif // IPFS_LOG_MACROS_H_