reduce frontend log spam from debug messages

This commit is contained in:
Hazelnoot 2025-05-10 13:20:44 -04:00
parent f42f9ee0b5
commit 87dc73d700
22 changed files with 32 additions and 32 deletions

View file

@ -28,7 +28,7 @@ console.log('Sharkey Embed');
//#region Embedパラメータの取得・パース
const params = new URLSearchParams(location.search);
const embedParams = parseEmbedParams(params);
if (_DEV_) console.log(embedParams);
if (_DEV_) console.debug(embedParams);
//#endregion
//#region テーマ

View file

@ -28,7 +28,7 @@ let defaultIframeId: string | null = null;
export function setIframeId(id: string): void {
if (defaultIframeId != null) return;
if (_DEV_) console.log('setIframeId', id);
if (_DEV_) console.debug('setIframeId', id);
defaultIframeId = id;
}
@ -40,7 +40,7 @@ export function postMessageToParentWindow<T extends PostMessageEventType = PostM
if (_iframeId == null) {
_iframeId = defaultIframeId;
}
if (_DEV_) console.log('postMessageToParentWindow', type, _iframeId, payload);
if (_DEV_) console.debug('postMessageToParentWindow', type, _iframeId, payload);
window.parent.postMessage({
type,
iframeId: _iframeId,

View file

@ -54,7 +54,7 @@ function safeURIDecode(str: string): string {
const page = location.pathname.split('/')[2];
const contentId = safeURIDecode(location.pathname.split('/')[3]);
if (_DEV_) console.log(page, contentId);
if (_DEV_) console.debug(page, contentId);
const embedParams = inject(DI.embedParams, defaultEmbedParams);

View file

@ -20,7 +20,7 @@ try {
});
} catch (err) {
console.warn(err);
if (_DEV_) console.log('[Intl] Fallback to en-US');
if (_DEV_) console.debug('[Intl] Fallback to en-US');
// Fallback to en-US
_dateTimeFormat = new Intl.DateTimeFormat('en-US', {
@ -43,7 +43,7 @@ try {
_numberFormat = new Intl.NumberFormat(versatileLang);
} catch (err) {
console.warn(err);
if (_DEV_) console.log('[Intl] Fallback to en-US');
if (_DEV_) console.debug('[Intl] Fallback to en-US');
// Fallback to en-US
_numberFormat = new Intl.NumberFormat('en-US');

View file

@ -28,13 +28,13 @@ export class WorkerMultiDispatch<POST = unknown, RETURN = unknown> {
});
this.finalizationRegistry.register(this, this.symbol);
if (_DEV_) console.log('WorkerMultiDispatch: Created', this);
if (_DEV_) console.debug('WorkerMultiDispatch: Created', this);
}
public postMessage(message: POST, options?: Transferable[] | StructuredSerializeOptions, useWorkerNumber: WorkerNumberGetter = this.getUseWorkerNumber) {
let workerNumber = useWorkerNumber(this.prevWorkerNumber, this.workers.length);
workerNumber = Math.abs(Math.round(workerNumber)) % this.workers.length;
if (_DEV_) console.log('WorkerMultiDispatch: Posting message to worker', workerNumber, useWorkerNumber);
if (_DEV_) console.debug('WorkerMultiDispatch: Posting message to worker', workerNumber, useWorkerNumber);
this.prevWorkerNumber = workerNumber;
// 不毛だがunionをoverloadに突っ込めない
@ -64,7 +64,7 @@ export class WorkerMultiDispatch<POST = unknown, RETURN = unknown> {
public terminate() {
this.terminated = true;
if (_DEV_) console.log('WorkerMultiDispatch: Terminating', this);
if (_DEV_) console.debug('WorkerMultiDispatch: Terminating', this);
this.workers.forEach(worker => {
worker.terminate();
});

View file

@ -142,7 +142,7 @@ function reset() {
function remove() {
if (captcha.value.remove && captchaWidgetId.value) {
try {
if (_DEV_) console.log('remove', props.provider, captchaWidgetId.value);
if (_DEV_) console.debug('remove', props.provider, captchaWidgetId.value);
captcha.value.remove(captchaWidgetId.value);
} catch (error: unknown) {
// ignore

View file

@ -52,7 +52,7 @@ async function fetchLanguage(to: string): Promise<void> {
return bundle.id === language || bundle.aliases?.includes(language);
});
if (bundles.length > 0) {
if (_DEV_) console.log(`Loading language: ${language}`);
if (_DEV_) console.debug(`Loading language: ${language}`);
await highlighter.loadLanguage(bundles[0].import);
codeLang.value = language;
} else {

View file

@ -106,7 +106,7 @@ windowRouter.addListener('replace', ctx => {
});
windowRouter.addListener('change', ctx => {
if (_DEV_) console.log('windowRouter: change', ctx.fullPath);
if (_DEV_) console.debug('windowRouter: change', ctx.fullPath);
searchMarkerId.value = getSearchMarker(ctx.fullPath);
});

View file

@ -386,7 +386,7 @@ function prepend(item: MisskeyEntity): void {
return;
}
if (_DEV_) console.log(isHead(), isPausingUpdate);
if (_DEV_) console.debug(isHead(), isPausingUpdate);
if (isHead() && !isPausingUpdate) unshiftItems([item]);
else prependQueue(item);

View file

@ -307,7 +307,7 @@ async function onSubmit(): Promise<void> {
emit('approvalPending');
} else {
const resJson = (await res.json()) as Misskey.entities.SignupResponse;
if (_DEV_) console.log(resJson);
if (_DEV_) console.debug(resJson);
emit('signup', resJson);

View file

@ -274,7 +274,7 @@ export class Nirax<DEF extends RouteDef[]> extends EventEmitter<RouterEvents> {
} else {
redirectPath = current.route.redirect + (current._parsedRoute.queryString ? '?' + current._parsedRoute.queryString : '') + (current._parsedRoute.hash ? '#' + current._parsedRoute.hash : '');
}
if (_DEV_) console.log('Redirecting to: ', redirectPath);
if (_DEV_) console.debug('Redirecting to: ', redirectPath);
if (_redirected && this.redirectCount++ > 10) {
throw new Error('redirect loop detected');
}

View file

@ -97,7 +97,7 @@ export class Pizzax<T extends StateDef> {
if (this.isPureObject(value) && this.isPureObject(def)) {
const merged = deepMerge(value, def);
if (_DEV_) console.log('Merging state. Incoming: ', value, ' Default: ', def, ' Result: ', merged);
if (_DEV_) console.debug('Merging state. Incoming: ', value, ' Default: ', def, ' Result: ', merged);
return merged as X;
}

View file

@ -243,13 +243,13 @@ if (game.value.isStarted && !game.value.isEnded) {
useInterval(() => {
if (game.value.isEnded) return;
const crc32 = engine.value.calcCrc32();
if (_DEV_) console.log('crc32', crc32);
if (_DEV_) console.debug('crc32', crc32);
misskeyApi('reversi/verify', {
gameId: game.value.id,
crc32: crc32.toString(),
}).then((res) => {
if (res.desynced) {
if (_DEV_) console.log('resynced');
if (_DEV_) console.debug('resynced');
restoreGame(res.game!);
}
});

View file

@ -130,7 +130,7 @@ function syncBetweenTabs() {
latestSyncedAt = Date.now();
if (_DEV_) console.log('prefer:synced');
if (_DEV_) console.debug('prefer:synced');
}
window.setInterval(syncBetweenTabs, 5000);

View file

@ -142,11 +142,11 @@ export class PreferencesManager {
const v = JSON.parse(JSON.stringify(value)); // deep copy 兼 vueのプロキシ解除
if (deepEqual(this.s[key], v)) {
if (_DEV_) console.log('(skip) prefer:commit', key, v);
if (_DEV_) console.debug('(skip) prefer:commit', key, v);
return;
}
if (_DEV_) console.log('prefer:commit', key, v);
if (_DEV_) console.debug('prefer:commit', key, v);
this.rewriteRawState(key, v);
@ -250,13 +250,13 @@ export class PreferencesManager {
if (!deepEqual(cloudValue, record[1])) {
this.rewriteRawState(key, cloudValue);
record[1] = cloudValue;
if (_DEV_) console.log('cloud fetched', key, cloudValue);
if (_DEV_) console.debug('cloud fetched', key, cloudValue);
}
}
}
this.save();
if (_DEV_) console.log('cloud fetch completed');
if (_DEV_) console.debug('cloud fetch completed');
}
public static newProfile(): PreferencesProfile {

View file

@ -153,7 +153,7 @@ export async function restoreFromCloudBackup() {
scope: ['client', 'preferences', 'backups'],
});
if (_DEV_) console.log(keys);
if (_DEV_) console.debug(keys);
if (keys.length === 0) {
os.alert({
@ -179,7 +179,7 @@ export async function restoreFromCloudBackup() {
key: select.result,
});
if (_DEV_) console.log(profile);
if (_DEV_) console.debug(profile);
miLocalStorage.setItem('preferences', JSON.stringify(profile));
miLocalStorage.setItem('hidePreferencesRestoreSuggestion', 'true');

View file

@ -8,4 +8,4 @@ import { v4 as uuid } from 'uuid';
// HMR有効時にバグか知らんけど複数回実行されるのでその対策
export const TAB_ID = window.sessionStorage.getItem('TAB_ID') ?? uuid();
window.sessionStorage.setItem('TAB_ID', TAB_ID);
if (_DEV_) console.log('TAB_ID', TAB_ID);
if (_DEV_) console.debug('TAB_ID', TAB_ID);

View file

@ -531,7 +531,7 @@ export function getNoteMenu(props: {
}
const cleanup = () => {
if (_DEV_) console.log('note menu cleanup', cleanups);
if (_DEV_) console.debug('note menu cleanup', cleanups);
for (const cl of cleanups) {
cl();
}

View file

@ -54,7 +54,7 @@ export async function getNoteVersionsMenu(props: { note: Misskey.entities.Note }
});
const cleanup = () => {
if (_DEV_) console.log('note menu cleanup', cleanups);
if (_DEV_) console.debug('note menu cleanup', cleanups);
for (const cl of cleanups) {
cl();
}

View file

@ -443,7 +443,7 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router
return {
menu: menuItems,
cleanup: () => {
if (_DEV_) console.log('user menu cleanup', cleanups);
if (_DEV_) console.debug('user menu cleanup', cleanups);
for (const cl of cleanups) {
cl();
}

View file

@ -19,7 +19,7 @@ try {
});
} catch (err) {
console.warn(err);
if (_DEV_) console.log('[Intl] Fallback to en-US');
if (_DEV_) console.debug('[Intl] Fallback to en-US');
// Fallback to en-US
_dateTimeFormat = new Intl.DateTimeFormat('en-US', {
@ -42,7 +42,7 @@ try {
_numberFormat = new Intl.NumberFormat(versatileLang);
} catch (err) {
console.warn(err);
if (_DEV_) console.log('[Intl] Fallback to en-US');
if (_DEV_) console.debug('[Intl] Fallback to en-US');
// Fallback to en-US
_numberFormat = new Intl.NumberFormat('en-US');

View file

@ -134,7 +134,7 @@ export function playMisskeySfx(operationType: OperationType) {
if (!succeed && sound.type === '_driveFile_') {
// ドライブファイルが存在しない場合はデフォルトのサウンドを再生する
const soundName = PREF_DEF[`sound_${operationType}`].default.type as Exclude<SoundType, '_driveFile_'>;
if (_DEV_) console.log(`Failed to play sound: ${sound.fileUrl}, so play default sound: ${soundName}`);
if (_DEV_) console.debug(`Failed to play sound: ${sound.fileUrl}, so play default sound: ${soundName}`);
playMisskeySfxFileInternal({
type: soundName,
volume: sound.volume,