blob: d99719108ff8b10dff26cb81d287a6193326bb87 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COBALT_LOGGING_H_
#define COBALT_LOGGING_H_
#ifdef HAVE_GLOG
#include <glog/logging.h>
#define INIT_LOGGING(val) \
{ \
google::InitGoogleLogging(val); \
google::InstallFailureSignalHandler(); \
}
#elif defined(__Fuchsia__)
#include "lib/syslog/cpp/logger.h"
#include "src/lib/fxl/logging.h"
#define INIT_LOGGING(val)
#define VLOG(verboselevel) FXL_VLOG(verboselevel)
#define LOG(level) FX_LOGS(level)
#define LOG_FIRST_N(verboselevel, n) FX_LOGS_FIRST_N(verboselevel, n)
#define CHECK(condition) FXL_CHECK(condition)
#define CHECK_EQ(val1, val2) FXL_CHECK((val1 == val2))
#define CHECK_NE(val1, val2) FXL_CHECK((val1 != val2))
#define CHECK_LE(val1, val2) FXL_CHECK((val1 <= val2))
#define CHECK_LT(val1, val2) FXL_CHECK((val1 < val2))
#define CHECK_GE(val1, val2) FXL_CHECK((val1 >= val2))
#define CHECK_GT(val1, val2) FXL_CHECK((val1 > val2))
#else
#error "Either HAVE_GLOG or __Fuchsia__ must be defined"
#endif
#endif // COBALT_LOGGING_H_