forked from luofei614/SocketLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.js
More file actions
38 lines (35 loc) · 764 Bytes
/
Copy pathlog.js
File metadata and controls
38 lines (35 loc) · 764 Bytes
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
/**
* github: https://github.com/luofei614/SocketLog
* @author luofei614<weibo.com/luofei614>
*/
chrome.extension.onMessage.addListener(
function(logs)
{
if('object'!=typeof(logs))
{
return ;
}
logs.forEach(function(log)
{
if(console[log.type])
{
if(log.css)
{
console[log.type]('%c'+log.msg,log.css);
}
else
{
console[log.type](log.msg);
}
return ;
}
if('alert'==log.type)
{
alert(log.msg);
}
else
{
alert('SocketLog type error, '+log.type);
}
});
});