Skip to content

Commit

Permalink
fix: console spam (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
luxass authored Aug 4, 2023
1 parent d7a96ae commit cf380f2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/extension.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const vscode = require("vscode");
const { monitorConfigChanges } = require("./lib/change-listener");
const { syncOriginal } = require("./lib/theme");

const {
log
} = require("./lib/log")
/**
* @param {vscode.ExtensionContext} context
*/
async function activate(context) {
console.log("miguelsolorio.symbols activated");

log.info("miguelsolorio.symbols activated")
await syncOriginal();
monitorConfigChanges();

Expand Down
6 changes: 4 additions & 2 deletions src/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const vscode = require("vscode");

const {
log
} = require("./log")
const defaultConfig = require("../symbol-icon-theme.json");
const pkgConfig = require("../../package.json");
const { getSoureFile, writeThemeFile } = require("./theme");
Expand Down Expand Up @@ -62,7 +64,7 @@ function updateConfig(config) {
const themeJSON = getSoureFile();

for (let key in config) {
console.log(`symbols.${key} changed, updating to ${config[key]}`);
log.info(`symbols.${key} changed, updating to ${config[key]}`);
const updateHandler = updateThemeJSONHandlers[key];
if (updateHandler) {
vscode.workspace.getConfiguration("symbols").update(key, config[key], true);
Expand Down
13 changes: 13 additions & 0 deletions src/lib/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const vscode = require("vscode");

const channel = vscode.window.createOutputChannel('Symbols')
const log = {
info: (...args) => {
const time = new Date().toLocaleTimeString()
channel.appendLine(`[INFO ${time}] ${args.join(' ')}`)
},
}

module.exports = {
log
}
3 changes: 2 additions & 1 deletion src/lib/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require("fs");
const path = require("path");
const { PKG_PROP_MAP } = require("./constants");
const { confirmReload } = require("./window");
const { log } = require("./log");

const THEME_FILE = "symbol-icon-theme.modified.json";
const BACKUP_THEME_FILE = "symbol-icon-theme.bkp.json";
Expand Down Expand Up @@ -131,7 +132,7 @@ async function syncOriginal() {

const stringifiedBackup = JSON.stringify(backupJSON[key]);
if (stringifiedSource != stringifiedBackup) {
console.log({
log.info({
stringifiedSource,
stringifiedBackup,
});
Expand Down

0 comments on commit cf380f2

Please sign in to comment.