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

ログの改善 #1910

Merged
merged 9 commits into from
Apr 9, 2024
1 change: 1 addition & 0 deletions src/domain/frontend/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** ログ出力用の関数を生成する。ブラウザ専用。 */
// TODO: DIできるようにする
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目的語があるとコメントが不要になったかどうかの判断しやすいかも

Suggested change
// TODO: DIできるようにする
// TODO: window.backendをDIできるようにする

export function createLogger(scope: string) {
const createInner =
(method: "logInfo" | "logError" | "logWarn") =>
Expand Down
2 changes: 1 addition & 1 deletion src/store/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const engineStoreState: EngineStoreState = {
engineSupportedDevices: {},
altPortInfos: {},
};
const { info } = createLogger("store/engine");

export const engineStore = createPartialStore<EngineStoreTypes>({
GET_ENGINE_INFOS: {
Expand Down Expand Up @@ -159,7 +160,6 @@ export const engineStore = createPartialStore<EngineStoreTypes>({
START_WAITING_ENGINE: {
action: createUILockAction(
async ({ state, commit, dispatch }, { engineId }) => {
const { info } = createLogger("START_WAITING_ENGINE");
let engineState: EngineState | undefined = state.engineStates[engineId];
if (engineState == undefined)
throw new Error(`No such engineState set: engineId == ${engineId}`);
Expand Down
4 changes: 3 additions & 1 deletion src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ import {
round,
} from "@/sing/utility";
import { createLogger } from "@/domain/frontend/log";
import { noteSchema } from "@/domain/project/schema";

const { info } = createLogger("store/singing");

const generateAudioEvents = async (
audioContext: BaseAudioContext,
Expand Down Expand Up @@ -762,7 +765,6 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
*/
RENDER: {
async action({ state, getters, commit, dispatch }) {
const { info } = createLogger("RENDER");
const searchPhrases = async (
singer: Singer | undefined,
keyRangeAdjustment: number,
Expand Down
Loading