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

feat: add logger #20

Merged
merged 1 commit into from
Apr 6, 2024
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
205 changes: 202 additions & 3 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"react": "^18.2.0",
"react-dom": "^18",
"react-toastify": "^10.0.5",
"tsx": "^4.7.1"
"tsx": "^4.7.1",
"winston": "^3.13.0"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.9",
Expand Down
5 changes: 3 additions & 2 deletions src/app/actions/change-password-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
import { ContainerData, OperationResult } from "../../types/types";
import QueriesService from "@/server/queries/queries.service";
import ContainerService from "@/utils/container.service";
import { logger } from "@/utils/logger";

export async function changeShellPasswordActionAsync(
shell: ContainerData,
Expand All @@ -16,12 +17,12 @@ export async function changeShellPasswordActionAsync(
).changePasswordAsync();

if (success) {
console.log("Password changed!");
logger.info("Password changed!");
await QueriesService.changeShellPasswordAsync(shell);
revalidatePath("/", "layout");
return { success: true };
}

console.log(`Error changing password! Error: ${error}`);
logger.warn(`Error changing password! Error: ${error}`);
return { success: false };
}
Loading