Strip ANSI escapes from log file text.
This commit is contained in:
parent
b9df7eec73
commit
1e35cb070f
5 changed files with 28 additions and 2366 deletions
33
.github/workflows/node.js.yml
vendored
33
.github/workflows/node.js.yml
vendored
|
@ -1,33 +0,0 @@
|
||||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
||||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
||||||
|
|
||||||
name: Node.js CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "master" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [18.x]
|
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
- run: npm ci
|
|
||||||
# Don't run updateCheck for now
|
|
||||||
#- run: npm run dev:updateCheck
|
|
||||||
- run: npm run build
|
|
||||||
#- run: npm test
|
|
3
index.ts
3
index.ts
|
@ -38,13 +38,14 @@ function getTime() : string {
|
||||||
}
|
}
|
||||||
|
|
||||||
let queuedForLog = "";
|
let queuedForLog = "";
|
||||||
|
const LOG_FILE_REGEX = /\x1B\[(\d.m|.m)/gm;
|
||||||
|
|
||||||
function log(tag:LogTag, log:string, logType:LogType) : void {
|
function log(tag:LogTag, log:string, logType:LogType) : void {
|
||||||
const stringTime = getTime(),
|
const stringTime = getTime(),
|
||||||
fileTag = TagsForFile[tag],
|
fileTag = TagsForFile[tag],
|
||||||
consoleTag = LogTags[tag];
|
consoleTag = LogTags[tag];
|
||||||
|
|
||||||
queuedForLog += `${stringTime} ${fileTag} ${log}\n`;
|
queuedForLog += `${stringTime} ${fileTag} ${log.replace(LOG_FILE_REGEX, "")}\n`;
|
||||||
switch (logType) {
|
switch (logType) {
|
||||||
case LogType.INFO:
|
case LogType.INFO:
|
||||||
return console.log(`${dyetty.green(stringTime)} ${consoleTag} ${log}`);
|
return console.log(`${dyetty.green(stringTime)} ${consoleTag} ${log}`);
|
||||||
|
|
2344
package-lock.json
generated
2344
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -16,10 +16,9 @@
|
||||||
"dyetty": "^1.0.1"
|
"dyetty": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.0",
|
"@types/node": "^22.10.4",
|
||||||
"check-outdated": "^2.12.0",
|
"check-outdated": "^2.12.0",
|
||||||
"ts-loader": "^9.4.4",
|
"ts-node": "^10.9.2",
|
||||||
"ts-node": "^10.9.1",
|
"typescript": "^5.7.2"
|
||||||
"typescript": "^5.1.6"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,12 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "CommonJS",
|
"module": "CommonJS",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"target": "es6",
|
"target": "ES2022",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"rootDir": "./",
|
"rootDir": "./",
|
||||||
"outDir": "./lib/",
|
"outDir": "./lib/",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"declaration": true,
|
"declaration": true
|
||||||
"lib": [
|
|
||||||
"ES2021.String"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue