Permalink
Browse files

console, feat: only allow console config in master worker.

  • Loading branch information...
xicilion committed Jul 22, 2018
1 parent ddc582e commit 7b72c348294804519657497b1799fc2a44248e23
Showing with 15 additions and 1 deletion.
  1. +15 −1 fibjs/src/console/console_log.cpp
@@ -107,6 +107,9 @@ result_t console_base::set_loglevel(int32_t newVal)
result_t console_base::add(exlib::string type)
{
Isolate* isolate = Isolate::current();
if (isolate->m_id > 1)
return CHECK_ERROR(CALL_E_INVALID_CALL);
v8::Local<v8::Object> o = v8::Object::New(isolate->m_isolate);
o->Set(isolate->NewString("type", 4), isolate->NewString(type));
@@ -115,8 +118,11 @@ result_t console_base::add(exlib::string type)
result_t console_base::add(v8::Local<v8::Object> cfg)
{
v8::Local<v8::Value> type;
Isolate* isolate = Isolate::current();
if (isolate->m_id > 1)
return CHECK_ERROR(CALL_E_INVALID_CALL);
v8::Local<v8::Value> type;
type = cfg->Get(isolate->NewString("type", 4));
if (IsEmpty(type))
@@ -161,6 +167,10 @@ result_t console_base::add(v8::Local<v8::Object> cfg)
result_t console_base::add(v8::Local<v8::Array> cfg)
{
Isolate* isolate = Isolate::current();
if (isolate->m_id > 1)
return CHECK_ERROR(CALL_E_INVALID_CALL);
int32_t sz = cfg->Length();
int32_t i;
result_t hr;
@@ -189,6 +199,10 @@ result_t console_base::add(v8::Local<v8::Array> cfg)
result_t console_base::reset()
{
Isolate* isolate = Isolate::current();
if (isolate->m_id > 1)
return CHECK_ERROR(CALL_E_INVALID_CALL);
int32_t i;
for (i = 0; i < MAX_LOGGER; i++) {

0 comments on commit 7b72c34

Please sign in to comment.