cleanup, download lit, log function
This commit is contained in:
Vendored
+20
-4
@@ -32,10 +32,6 @@
|
||||
"",
|
||||
"export async function main(ns) {",
|
||||
" // ns.disableLog('ALL');",
|
||||
"",
|
||||
" async function writeLog(obj) {",
|
||||
" await ns.tryWritePort($1, obj + '\\n');",
|
||||
" }",
|
||||
" ",
|
||||
" $2",
|
||||
"}"
|
||||
@@ -60,6 +56,26 @@
|
||||
],
|
||||
"description": "NS terminal print"
|
||||
},
|
||||
"writelog": {
|
||||
"scope": "",
|
||||
"prefix": "writelog",
|
||||
"body": [
|
||||
"async function writeLog(type, obj) {",
|
||||
" let timeNow = new Date();",
|
||||
" let year = timeNow.getFullYear().toString().substring(2);",
|
||||
" let month = (timeNow.getMonth() < 9 ? '0' : '') + (timeNow.getMonth() + 1);",
|
||||
" let day = (timeNow.getDate() < 10 ? '0' : '') + timeNow.getDate();",
|
||||
" let hour = (timeNow.getHours() < 10 ? '0' : '') + timeNow.getHours();",
|
||||
" let minute = (timeNow.getMinutes() < 10 ? '0' : '') + timeNow.getMinutes();",
|
||||
" let second = (timeNow.getSeconds() < 10 ? '0' : '') + timeNow.getSeconds();",
|
||||
" let timestamp = `\\${year}\\${month}\\${day}_\\${hour}\\${minute}\\${second}`;",
|
||||
" await ns.tryWritePort($1, `t\\${timestamp}_\\${type} = \\${obj};\\n`);",
|
||||
" ",
|
||||
" if (['ERROR', 'TERMINAL'].indexOf(type) != -1) ns.tprint(`\\${timestamp} \\${type} = \\${obj}`);",
|
||||
"}"
|
||||
],
|
||||
"description": "writelog function definition"
|
||||
},
|
||||
"log": {
|
||||
"scope": "",
|
||||
"prefix": "log",
|
||||
|
||||
Reference in New Issue
Block a user