forked from magicoflolis/Userscript-Plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.js
More file actions
49 lines (47 loc) · 1.05 KB
/
Copy pathlogger.js
File metadata and controls
49 lines (47 loc) · 1.05 KB
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
'use strict';
// #region Console
const dbg = (...msg) => {
const dt = new Date();
console.debug(
'[%cMagic Userscript+%c] %cDBG',
'color: rgb(29, 155, 240);',
'',
'color: rgb(255, 212, 0);',
`[${dt.getHours()}:${('0' + dt.getMinutes()).slice(-2)}:${('0' + dt.getSeconds()).slice(-2)}]`,
...msg
);
};
const err = (...msg) => {
console.error(
'[%cMagic Userscript+%c] %cERROR',
'color: rgb(29, 155, 240);',
'',
'color: rgb(249, 24, 128);',
...msg
);
for (const ex of msg) {
if (typeof ex === 'object' && 'cause' in ex && typeof alert !== 'undefined') {
alert(`[Magic Userscript+] (${ex.cause}) ${ex.message}`);
}
}
};
const info = (...msg) => {
console.info(
'[%cMagic Userscript+%c] %cINF',
'color: rgb(29, 155, 240);',
'',
'color: rgb(0, 186, 124);',
...msg
);
};
const log = (...msg) => {
console.log(
'[%cMagic Userscript+%c] %cLOG',
'color: rgb(29, 155, 240);',
'',
'color: rgb(219, 160, 73);',
...msg
);
};
// #endregion
export { dbg, err, info, log };