logging.cc 797 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "include/cppgc/internal/logging.h"
#include "include/cppgc/source-location.h"

#include "src/base/logging.h"

namespace cppgc {
namespace internal {

void DCheckImpl(const char* message, const SourceLocation& loc) {
  V8_Dcheck(loc.FileName(), static_cast<int>(loc.Line()), message);
}

void FatalImpl(const char* message, const SourceLocation& loc) {
#if DEBUG
  V8_Fatal(loc.FileName(), static_cast<int>(loc.Line()), "Check failed: %s.",
           message);
#elif !defined(OFFICIAL_BUILD)
  V8_Fatal("Check failed: %s.", message);
#else
  V8_Fatal("ignored");
#endif
}

}  // namespace internal
}  // namespace cppgc