Alexander Blom 27f504e9e3 Add Console agent
Summary: Adds the Console agent which we hook from our console polyfill. It captures the stack and strips the frames of the polyfill.

Reviewed By: davidaurelio

Differential Revision: D4021502

fbshipit-source-id: 49cb700a139270485b7595e85e52d50c9a620db6
2016-11-02 12:29:15 -07:00

40 lines
879 B
C++

// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include "Agent.h"
namespace JSC {
class JSGlobalObject;
class ExecState;
class JSArray;
}
namespace Inspector {
class InjectedScriptManager;
}
namespace facebook {
namespace react {
class ConsoleAgent : public Agent {
public:
ConsoleAgent(JSC::JSGlobalObject& globalObject, Inspector::InjectedScriptManager* injectedScriptManager);
void log(JSC::ExecState* execState, std::string message);
void log(JSC::ExecState* execState, std::string level, std::string message, JSC::JSArray* params, size_t framesToSkip);
private:
bool enabled_{false};
JSC::JSGlobalObject& globalObject_;
Inspector::InjectedScriptManager* injectedScriptManager_;
folly::dynamic convertParams(JSC::ExecState* execState, JSC::JSArray* params);
std::string getDomain() override {
return "Console";
}
};
}
}