@ks-opdev/cli
Version:
ksodev: A CLI based on the WPS Open Platform
1 lines • 3.86 kB
JavaScript
(function(_0x559071,_0x496cce){const _0x591496=a16_0x3016,_0x2b028e=_0x559071();while(!![]){try{const _0x247be1=parseInt(_0x591496(0xc3))/0x1+parseInt(_0x591496(0xc0))/0x2*(-parseInt(_0x591496(0xbd))/0x3)+parseInt(_0x591496(0xcc))/0x4+-parseInt(_0x591496(0xba))/0x5*(parseInt(_0x591496(0xbc))/0x6)+-parseInt(_0x591496(0xc2))/0x7*(-parseInt(_0x591496(0xc8))/0x8)+-parseInt(_0x591496(0xc6))/0x9+parseInt(_0x591496(0xcd))/0xa;if(_0x247be1===_0x496cce)break;else _0x2b028e['push'](_0x2b028e['shift']());}catch(_0x13fb04){_0x2b028e['push'](_0x2b028e['shift']());}}}(a16_0x2b1f,0x68a1f));import{createWriteStream,existsSync,mkdirSync}from'node:fs';import{dirname}from'node:path';import{format as a16_0x39fc1f}from'node:util';import{Default}from'./common.js';let levelRef=Default,logFilePathGlobal='',fileStream=null;const ANSI_REGEX=/\x1B\[[0-?]*[ -/]*[@-~]/g;function isoNow(){const _0x1c8c5e=a16_0x3016;return new Date()[_0x1c8c5e(0xc7)]();}function ensureDir(_0x13b086){const _0x43b47d=dirname(_0x13b086);!existsSync(_0x43b47d)&&mkdirSync(_0x43b47d,{'recursive':!![]});}function writeFileLine(_0x3af495){const _0x1fa0ce=a16_0x3016;try{fileStream&&fileStream[_0x1fa0ce(0xc1)](_0x3af495+'\x0a');}catch{}}function extractTraceIdFromPath(_0x456e30){const _0x2fea38=a16_0x3016,_0x1edc7c=_0x456e30['split'](/[\\/]/)['pop']()||'',_0x493396=_0x1edc7c['lastIndexOf']('.');return _0x493396>0x0?_0x1edc7c[_0x2fea38(0xcb)](0x0,_0x493396):_0x1edc7c;}function a16_0x3016(_0x565d9a,_0x5a15f2){const _0x2b1f4b=a16_0x2b1f();return a16_0x3016=function(_0x3016d3,_0xa13be4){_0x3016d3=_0x3016d3-0xba;let _0x2f183a=_0x2b1f4b[_0x3016d3];return _0x2f183a;},a16_0x3016(_0x565d9a,_0x5a15f2);}export function NewLoggerWithLevel(_0x94a95,_0x2603b6){const _0x88ecf2=a16_0x3016;levelRef=Number[_0x88ecf2(0xc4)](_0x94a95)?Math[_0x88ecf2(0xd0)](_0x94a95):Default,logFilePathGlobal=_0x2603b6;if(logFilePathGlobal)try{ensureDir(logFilePathGlobal),fileStream=createWriteStream(logFilePathGlobal,{'flags':'a'});}catch{fileStream=null;}}export function getLogFilePath(){return logFilePathGlobal;}export function getTraceId(){return extractTraceIdFromPath(logFilePathGlobal);}function a16_0x2b1f(){const _0x3950d3=['211056ZlKERk','12696950MLRKwr','join','exit','trunc','3293005BcfAJF','stack','6VtRnea','21hpiQAZ','err\x20','log','146502HRaMrx','write','1169yWmeHc','676250qpimxg','isFinite','replace','6850494DJnhiJ','toISOString','17360LrCvIw','message','\x20err\x20','slice'];a16_0x2b1f=function(){return _0x3950d3;};return a16_0x2b1f();}export function V(_0x4b0b0d){return{'Info':(_0x3d335e,..._0x48e3d8)=>{const _0x189553=a16_0x3016,_0x362d12=a16_0x39fc1f(_0x3d335e,..._0x48e3d8);writeFileLine(isoNow()+'\x20'+_0x362d12[_0x189553(0xc5)](ANSI_REGEX,'')),_0x4b0b0d<levelRef&&console[_0x189553(0xbf)](_0x362d12);}};}export function Error(_0x1e1875,..._0x207dc4){const _0x1a2749=a16_0x3016,_0x52c0cb=_0x207dc4[_0x1a2749(0xce)]('\x20'),_0x4c1142=_0x52c0cb?_0x52c0cb+_0x1a2749(0xca)+(_0x1e1875?_0x1e1875[_0x1a2749(0xbb)]||_0x1e1875[_0x1a2749(0xc9)]:''):_0x1a2749(0xbe)+(_0x1e1875?_0x1e1875[_0x1a2749(0xbb)]||_0x1e1875[_0x1a2749(0xc9)]:'');writeFileLine(isoNow()+'\x20'+_0x4c1142['replace'](ANSI_REGEX,'')),console['error'](_0x4c1142);}export function Fatal(_0x56c629,..._0x51d730){const _0x2a1a09=a16_0x3016,_0x3beae2=_0x51d730[_0x2a1a09(0xce)]('\x20'),_0x564b0c=_0x3beae2?_0x3beae2+_0x2a1a09(0xca)+(_0x56c629?_0x56c629['stack']||_0x56c629[_0x2a1a09(0xc9)]:''):_0x2a1a09(0xbe)+(_0x56c629?_0x56c629[_0x2a1a09(0xbb)]||_0x56c629['message']:'');writeFileLine(isoNow()+'\x20'+_0x564b0c[_0x2a1a09(0xc5)](ANSI_REGEX,'')),console['error'](_0x564b0c),process[_0x2a1a09(0xcf)](0x1);}export function CleanLogFile(){}export function FileOnly(_0x15cc75,..._0x51c9ac){const _0x45c988=a16_0x3016,_0x2d6940=a16_0x39fc1f(_0x15cc75,..._0x51c9ac);writeFileLine(isoNow()+'\x20'+_0x2d6940[_0x45c988(0xc5)](ANSI_REGEX,''));}