-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
farreldarian
committed
Dec 26, 2023
1 parent
00b8df7
commit 403177d
Showing
2 changed files
with
11 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { logger as baseLogger } from '@prisma/sdk' | ||
import { GENERATOR_NAME } from 'src/constants' | ||
|
||
function info(message: string) { | ||
baseLogger.info(`${GENERATOR_NAME} — ${message}`) | ||
function log(message: string) { | ||
baseLogger.log(`${GENERATOR_NAME}: ${message}`) | ||
} | ||
|
||
function createTask() { | ||
const timeStarted = Date.now() | ||
return { | ||
end(message: string) { | ||
return info(`${message} in ${Date.now() - timeStarted}ms`) | ||
return log(`${message} in ${Date.now() - timeStarted}ms`) | ||
}, | ||
} | ||
} | ||
|
||
export const logger = { | ||
info, | ||
log, | ||
createTask, | ||
} |