-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrease_clientonly.cc
61 lines (43 loc) · 1.16 KB
/
grease_clientonly.cc
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
54
55
56
57
58
59
60
61
/**
* (c) 2015 WigWag Inc.
*
* Author: ed
*/
#include "logger.h"
#include "client_logger.h"
#include <v8.h>
#include <node.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "error-common.h"
using namespace node;
using namespace v8;
using namespace Grease;
NAN_METHOD(ErrorFromErrno) {
Nan::EscapableHandleScope scope;
if(info.Length() > 0 && info[0]->Int32Value()) {
Local<Value> err = _errcmn::errno_to_JS(info[0]->Int32Value(),"netkit: ");
scope.Escape(err);
} else {
scope.Escape(Nan::Undefined());
}
}
//NAN_METHJNewLoggerClient(const Arguments& args) {
// HandleScope scope;
//
// return scope.Close(GreaseLoggerClient::NewInstance(args));
//
//}
void InitAll(Handle<Object> exports, Handle<Object> module) {
// exports->Set(String::NewSymbol("newClient"), FunctionTemplate::New(NewLoggerClient)->GetFunction());
GreaseLoggerClient::Init(exports);
Handle<Object> errconsts = Nan::New<Object>();
_errcmn::DefineConstants(errconsts);
Nan::Set(exports,Nan::New<String>("ERR").ToLocalChecked(), errconsts);
}
NODE_MODULE(greaseLogClient, InitAll)