Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: console spam #108

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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