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 #ifndef V8_LOGGING_LOCAL_LOGGER_H_
6 #define V8_LOGGING_LOCAL_LOGGER_H_
7 
8 #include "src/base/logging.h"
9 #include "src/logging/log.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 // TODO(leszeks): Add support for logging from off-thread.
15 class LocalLogger {
16  public:
17   explicit LocalLogger(Isolate* isolate);
18 
is_logging() const19   bool is_logging() const { return is_logging_; }
is_listening_to_code_events() const20   bool is_listening_to_code_events() const {
21     return is_listening_to_code_events_;
22   }
23   void ScriptDetails(Script script);
24   void ScriptEvent(Logger::ScriptEventType type, int script_id);
25   void CodeLinePosInfoRecordEvent(Address code_start,
26                                   ByteArray source_position_table,
27                                   JitCodeEvent::CodeType code_type);
28 
29   void MapCreate(Map map);
30   void MapDetails(Map map);
31 
32  private:
33   Logger* logger_;
34   bool is_logging_;
35   bool is_listening_to_code_events_;
36 };
37 
38 }  // namespace internal
39 }  // namespace v8
40 
41 #endif  // V8_LOGGING_LOCAL_LOGGER_H_
42