Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download resources/app/javascript/appLogger.js from Pendrokar/xVASynth-TTS: direct link, hf CLI and curl.
- Browser
- Download file 985 Bytes
-
https://huggingface.co/spaces/Pendrokar/xVASynth-TTS/resolve/main/resources/app/javascript/appLogger.js
- Command line
-
hf download hf://spaces/Pendrokar/xVASynth-TTS/resources/app/javascript/appLogger.js
-
curl -L -o appLogger.js https://huggingface.co/spaces/Pendrokar/xVASynth-TTS/resolve/main/resources/app/javascript/appLogger.js
985 Bytes
| const fs = require("fs") | |
| class xVAAppLogger { | |
| constructor (fileLocation, appVersion) { | |
| this.lines = [] | |
| this.fileLocation = fileLocation | |
| if (fs.existsSync(fileLocation)) { | |
| const data = fs.readFileSync(fileLocation, "utf8") | |
| this.lines = data.split("\n") | |
| } | |
| this.prefix = "" | |
| this.log(`New session - ${appVersion}`) | |
| } | |
| log (message) { | |
| this.lines.push(`${(new Date()).toJSON().replace("T", "_")} |${this.prefix.length?` [${this.prefix}]:`:""} ${message}`) | |
| if (this.lines.length>1000) { | |
| this.lines = this.lines.slice(this.lines.length-1000, this.lines.length) | |
| } | |
| fs.writeFileSync(this.fileLocation, this.lines.join("\n"), "utf8") | |
| } | |
| print (message) { | |
| console.log(`${this.prefix.length?` [${this.prefix}]:`:""} ${message}`) | |
| } | |
| setPrefix (prefix) { | |
| this.prefix = prefix | |
| } | |
| } | |
| exports.xVAAppLogger = xVAAppLogger | |