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

ajoute le timestamp du log globalement #53

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function main() {

async function init(config: MeterConfig) {
info(
`[${dayjs().format('DD/MM HH:mm')}] New PRM detected, historical ${
`New PRM detected, historical ${
config.production ? 'production' : 'consumption'
} data import is starting`,
);
Expand All @@ -57,7 +57,7 @@ async function main() {

async function sync(config: MeterConfig) {
info(
`[${dayjs().format('DD/MM HH:mm')}] Synchronization started for ${
`Synchronization started for ${
config.production ? 'production' : 'consumption'
} data`,
);
Expand Down
9 changes: 5 additions & 4 deletions src/log.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Chalk } from 'chalk';
import dayjs from 'dayjs';

const chalk = new Chalk({ level: 1 });
export const debug = (str: string) => console.info(chalk.white(str));
export const info = (str: string) => console.info(chalk.blue(str));
export const warn = (str: string) => console.warn(chalk.yellow(str));
export const error = (str: string) => console.error(chalk.red(str));
export const debug = (str: string) => console.info('[', dayjs().format('DD/MM HH:mm:ss'), ']', chalk.white(str));
export const info = (str: string) => console.info('[', dayjs().format('DD/MM HH:mm:ss'), ']', chalk.blue(str));
export const warn = (str: string) => console.warn('[', dayjs().format('DD/MM HH:mm:ss'), ']', chalk.yellow(str));
export const error = (str: string) => console.error('[', dayjs().format('DD/MM HH:mm:ss'), ']', chalk.red(str));
Loading