Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
czzxueyang
cat
提交
578ca2b7
C
cat
项目概览
czzxueyang
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
578ca2b7
编写于
11月 20, 2019
作者:
G
GeekerSquare
提交者:
youyong205
11月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support NodeV12
上级
9642dfa8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
23 deletion
+23
-23
lib/node.js/src/nodecat.cc
lib/node.js/src/nodecat.cc
+23
-23
未找到文件。
lib/node.js/src/nodecat.cc
浏览文件 @
578ca2b7
...
...
@@ -18,7 +18,7 @@ namespace catapi {
isolate
->
ThrowException
(
Exception
::
TypeError
(
String
::
NewFromUtf8
(
isolate
,
"Appkey is required"
)));
return
;
}
String
::
Utf8Value
str
(
args
[
0
]
->
ToString
()
);
String
::
Utf8Value
str
(
isolate
,
args
[
0
]
);
CatClientConfig
config
=
DEFAULT_CCAT_CONFIG
;
config
.
enableHeartbeat
=
0
;
...
...
@@ -38,15 +38,15 @@ namespace catapi {
if
(
node
->
IsNull
()
||
node
->
IsUndefined
())
{
return
;
}
String
::
Utf8Value
messageType
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"messageType"
)))
->
ToString
(
));
Local
<
Context
>
ctx
=
isolate
->
GetCurrentContext
();
String
::
Utf8Value
messageType
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"messageType"
)
));
if
(
strcmp
(
*
messageType
,
"transaction"
)
==
0
)
{
String
::
Utf8Value
type
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"type"
)))
->
ToString
(
));
String
::
Utf8Value
name
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"name"
)))
->
ToString
(
));
String
::
Utf8Value
status
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"status"
)))
->
ToString
(
));
String
::
Utf8Value
data
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"data"
)))
->
ToString
(
));
double
begin
=
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"beginTimestamp"
))
->
NumberValue
();
double
end
=
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"endTimestamp"
))
->
NumberValue
();
String
::
Utf8Value
type
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"type"
)
));
String
::
Utf8Value
name
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"name"
)
));
String
::
Utf8Value
status
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"status"
)
));
String
::
Utf8Value
data
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"data"
)
));
double
begin
=
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"beginTimestamp"
))
->
NumberValue
(
ctx
)).
ToChecked
();
double
end
=
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"endTimestamp"
))
->
NumberValue
(
ctx
)).
ToChecked
();
CatTransaction
*
t
=
newTransaction
((
const
char
*
)
(
*
type
),
(
const
char
*
)
(
*
name
));
t
->
setDurationInMillis
(
t
,
static_cast
<
unsigned
long
long
int
>
(
end
-
begin
));
...
...
@@ -55,19 +55,19 @@ namespace catapi {
t
->
addData
(
t
,
(
const
char
*
)
(
*
data
));
// Iterate children recursively
Handle
<
Array
>
children
=
Handle
<
Array
>::
Cast
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"children"
)));
Array
*
children
=
Array
::
Cast
((
*
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"children"
))
)));
int
count
=
children
->
Length
();
for
(
u_int32_t
i
=
0
;
i
<
count
;
i
++
)
{
InnerSendNode
(
isolate
,
Handle
<
Object
>::
Cast
(
children
->
Get
(
i
)
));
InnerSendNode
(
isolate
,
Object
::
Cast
((
*
(
children
->
Get
(
i
))))
->
Clone
(
));
}
t
->
complete
(
t
);
}
else
if
(
strcmp
(
*
messageType
,
"event"
)
==
0
)
{
String
::
Utf8Value
type
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"type"
)))
->
ToString
(
));
String
::
Utf8Value
name
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"name"
)))
->
ToString
(
));
String
::
Utf8Value
status
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"status"
)))
->
ToString
(
));
String
::
Utf8Value
data
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"data"
)))
->
ToString
(
));
double
begin
((
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"beginTimestamp"
)))
->
NumberValue
());
String
::
Utf8Value
type
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"type"
)
));
String
::
Utf8Value
name
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"name"
)
));
String
::
Utf8Value
status
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"status"
)
));
String
::
Utf8Value
data
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"data"
)
));
double
begin
((
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"beginTimestamp"
)))
->
NumberValue
(
ctx
)).
ToChecked
());
CatEvent
*
e
=
newEvent
((
const
char
*
)
(
*
type
),
(
const
char
*
)
(
*
name
));
e
->
setTimestamp
(
e
,
static_cast
<
unsigned
long
long
int
>
(
begin
));
...
...
@@ -75,9 +75,9 @@ namespace catapi {
e
->
setStatus
(
e
,
(
const
char
*
)
(
*
status
));
e
->
complete
(
e
);
}
else
if
(
strcmp
(
*
messageType
,
"heartbeat"
)
==
0
)
{
String
::
Utf8Value
type
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"type"
)))
->
ToString
(
));
String
::
Utf8Value
name
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"name"
)))
->
ToString
(
));
String
::
Utf8Value
data
(
(
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"data"
)))
->
ToString
(
));
String
::
Utf8Value
type
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"type"
)
));
String
::
Utf8Value
name
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"name"
)
));
String
::
Utf8Value
data
(
isolate
,
node
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"data"
)
));
CatHeartBeat
*
h
=
newHeartBeat
((
const
char
*
)
(
*
type
),
(
const
char
*
)
(
*
name
));
h
->
addData
(
h
,
(
const
char
*
)
(
*
data
));
...
...
@@ -91,11 +91,11 @@ namespace catapi {
if
(
args
.
Length
()
==
0
)
{
return
;
}
Handle
<
Object
>
tree
=
Handle
<
Object
>::
Cast
(
args
[
0
]
);
Array
*
tree
=
Array
::
Cast
((
*
args
[
0
])
);
Handle
<
Object
>
root
=
Handle
<
Object
>::
Cast
(
tree
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"root"
)));
Array
*
root
=
Array
::
Cast
((
*
(
tree
->
Get
(
String
::
NewFromUtf8
(
isolate
,
"root"
))
)));
InnerSendNode
(
isolate
,
root
);
InnerSendNode
(
isolate
,
root
->
Clone
()
);
}
void
exports
(
Local
<
Object
>
exports
)
{
...
...
@@ -106,4 +106,4 @@ namespace catapi {
NODE_MODULE
(
nodecat
,
exports
)
}
// namespace catapi
\ No newline at end of file
}
// namespace catapi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录