mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-22 14:22:33 +01:00
* feat: ✨ initial bos wip * test: 🚨 mock balanceofsatoshis * test: 🚨 correct mock * chore: 🔧 rebalance mutation * chore: 🔧 add options * chore: 🔧 rebalance settings * chore: 🔧 value for inputs * fix: 🐛 styles and input * chore: 🔧 update bos * chore: 🔧 update deps * fix: 🐛 change rebalance invoice desc * style: 🎨 transparent header
25 lines
782 B
TypeScript
25 lines
782 B
TypeScript
import { createLogger, format, transports } from 'winston';
|
|
import getConfig from 'next/config';
|
|
|
|
const { serverRuntimeConfig = {} } = getConfig() || {};
|
|
const { logLevel } = serverRuntimeConfig;
|
|
|
|
const combinedFormat = format.combine(
|
|
format.label({ label: 'THUB' }),
|
|
format.splat(),
|
|
format.colorize(),
|
|
format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
|
|
format.printf((info: any) => {
|
|
if (typeof info.message === 'object') {
|
|
info.message = JSON.stringify(info.message, null, 4);
|
|
}
|
|
return `${info.timestamp} ${info.level} [${info.label}]: ${info.message}`;
|
|
})
|
|
);
|
|
|
|
export const logger = createLogger({
|
|
level: logLevel,
|
|
format: combinedFormat,
|
|
transports: [new transports.Console()],
|
|
silent: process.env.NODE_ENV === 'test' ? true : false,
|
|
});
|