Skip to content

Commit

Permalink
Add logger utility and integrate it into TaskItemTeacher component
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfganggreschus committed Mar 5, 2025
1 parent 93f64f8 commit e2ecd5c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module.exports = {
"@util-input-masks": getDir("src/modules/util/input-masks"),
"@util-device-detection": getDir("src/modules/util/device-detection"),
"@util-error-notification": getDir("src/modules/util/error-notification"),
"@util-logger": getDir("src/modules/util/logger"),
"@page-board": getDir("src/modules/page/board"),
"@page-class-members": getDir("src/modules/page/class-members"),
"@page-media-shelf": getDir("src/modules/page/media-shelf"),
Expand Down
5 changes: 3 additions & 2 deletions src/components/molecules/TaskItemTeacher.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { mount } from "@vue/test-utils";
import { VBtn, VHover, VListItem } from "vuetify/lib/components/index.mjs";
import TaskItemMenu from "./TaskItemMenu.vue";
import TaskItemTeacher from "./TaskItemTeacher.vue";
import { Logger } from "@util-logger";

const {
tasksTeacher,
Expand Down Expand Up @@ -356,8 +357,8 @@ describe("@/components/molecules/TaskItemTeacher", () => {
await menuBtn.trigger("click");

const hover = wrapper.findComponent(VHover);
// console.log only with custom logger
console.log(hover.vm.$props);

Logger.log(hover.vm.$props);

expect(
wrapper.findComponent(`[data-testid="task-edit"]`).isVisible()
Expand Down
3 changes: 3 additions & 0 deletions src/modules/util/logger/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Logger from "./logger";

export { Logger };
12 changes: 12 additions & 0 deletions src/modules/util/logger/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable no-console */
class Logger {
static log(...message: unknown[]) {
console.log(...message);
}

static error(...message: unknown[]) {
console.error(message);
}
}

export default Logger;
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@util-input-masks": ["src/modules/util/input-masks"],
"@util-device-detection": ["src/modules/util/device-detection"],
"@util-error-notification": ["src/modules/util/error-notification"],
"@util-logger": ["src/modules/util/logger"],
"@page-board": ["src/modules/page/board"],
"@page-class-members": ["src/modules/page/class-members"],
"@page-media-shelf": ["src/modules/page/media-shelf"],
Expand Down

0 comments on commit e2ecd5c

Please sign in to comment.