aboutsummaryrefslogtreecommitdiffstats
path: root/logger.js
blob: 5ab721167920c3d7ab4d3baa4418dc56e38168b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

const winston = require('winston');
const { combine, printf, colorize, align } = winston.format;

const logger = winston.createLogger({
  level: process.env.LOG_LEVEL || 'info',
  format: combine(
    colorize({ all: true }),
    align(),
    printf((info) => `${info.level}: ${info.message}`)
  ),
  transports: [new winston.transports.Console()],
});

logger.info('Logger initialized with level:', logger.level);

module.exports = { logger };