xref: /third_party/node/deps/v8/src/heap/cppgc/logging.cc (revision 1cb0ef41)
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "include/cppgc/internal/logging.h"
6#include "include/cppgc/source-location.h"
7
8#include "src/base/logging.h"
9
10namespace cppgc {
11namespace internal {
12
13void DCheckImpl(const char* message, const SourceLocation& loc) {
14  V8_Dcheck(loc.FileName(), static_cast<int>(loc.Line()), message);
15}
16
17void FatalImpl(const char* message, const SourceLocation& loc) {
18#if DEBUG
19  V8_Fatal(loc.FileName(), static_cast<int>(loc.Line()), "Check failed: %s.",
20           message);
21#elif !defined(OFFICIAL_BUILD)
22  V8_Fatal("Check failed: %s.", message);
23#else
24  V8_Fatal("ignored");
25#endif
26}
27
28}  // namespace internal
29}  // namespace cppgc
30