Repository navigation
Expand file tree
/
Copy pathConsole.h
More file actions
53 lines (43 loc) · 2.08 KB
/
Copy pathConsole.h
File metadata and controls
53 lines (43 loc) · 2.08 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef Console_h
#define Console_h
#include <string>
#include "Common.h"
#include "JSV8InspectorClient.h"
namespace tns {
class Console {
public:
static void Init(v8::Local<v8::Context> context);
static void AttachInspectorClient(
v8_inspector::JsV8InspectorClient* inspector);
static void DetachInspectorClient();
// Builds this realm's inspect function (Caches::InspectFunc) if it isn't
// there yet. Public so ns:util can re-export the same instance.
static void InitInspect(v8::Local<v8::Context> context);
private:
using ConsoleAPIType = v8_inspector::ConsoleAPIType;
static void AttachLogFunction(
v8::Local<v8::Context> context, v8::Local<v8::Object> console,
const std::string name,
v8::FunctionCallback callback = Console::LogCallback);
static void LogCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
static void AssertCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
static void DirCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
static void TimeCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
static void TimeEndCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
static std::string BuildStringFromArgs(
const v8::FunctionCallbackInfo<v8::Value>& args, int startingIndex = 0);
static const v8::Local<v8::String> BuildStringFromArg(
v8::Local<v8::Context> context, const v8::Local<v8::Value>& val);
static v8::Local<v8::String> InspectValue(v8::Local<v8::Context> context,
const v8::Local<v8::Value>& val,
int depth = -1);
static ConsoleAPIType VerbosityToInspectorMethod(const std::string level);
static void SendToDevToolsFrontEnd(
ConsoleAPIType method, const v8::FunctionCallbackInfo<v8::Value>& args);
static void SendToDevToolsFrontEnd(v8::Isolate* isolate,
ConsoleAPIType method,
const std::string& msg);
static v8_inspector::JsV8InspectorClient* inspector;
};
} // namespace tns
#endif /* Console_h */