-
Notifications
You must be signed in to change notification settings - Fork 1
/
grease.cc
68 lines (47 loc) · 1.34 KB
/
grease.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
62
63
64
65
66
67
68
/**
* (c) 2015 WigWag Inc.
*
* Author: ed
*/
#include "logger.h"
#include "client_logger.h"
#include <v8.h>
#include <node.h>
#include "nan.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) {
if(info.Length() > 0 && info[0]->Int32Value()) {
Local<Value> err = _errcmn::errno_to_JS(info[0]->Int32Value(),"netkit: ");
info.GetReturnValue().Set(err);
}
}
//NAN_METHOD(NewLogger) {
// info.GetReturnValue().Set(GreaseLogger::NewInstance(args));
//
//}
//Handle<Value> NewLoggerClient(const Arguments& args) {
// HandleScope scope;
//
// return scope.Close(GreaseLoggerClient::NewInstance(args));
//
//}
void InitAll(Handle<Object> exports, Handle<Object> module) {
// exports->Set(String::NewSymbol("newLogger"), FunctionTemplate::New(NewLogger)->GetFunction());
// exports->Set(String::NewSymbol("newClient"), FunctionTemplate::New(NewLoggerClient)->GetFunction());
GreaseLogger::Init(exports);
GreaseLoggerClient::Init(exports);
Handle<Object> errconsts = Nan::New<Object>();
_errcmn::DefineConstants(errconsts);
Nan::Set(exports,Nan::New<String>("ERR").ToLocalChecked(), errconsts);
}
NODE_MODULE(greaseLog, InitAll)