You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
783 B
TypeScript
26 lines
783 B
TypeScript
5 years ago
|
import * as fsx from "fs-extra";
|
||
|
import * as yaml from "js-yaml";
|
||
|
import * as winston from "winston";
|
||
|
|
||
|
/**
|
||
|
* Defines global variables to be used.
|
||
|
*/
|
||
|
namespace globals {
|
||
|
export const config = yaml.safeLoad(fsx.readFileSync("config.yaml", "utf-8"));
|
||
|
export const logger = winston.createLogger({
|
||
|
transports: [
|
||
|
new winston.transports.Console({
|
||
|
format: winston.format.combine(
|
||
|
winston.format.timestamp(),
|
||
|
winston.format.colorize(),
|
||
|
winston.format.printf(({ level, message, label, timestamp }) => {
|
||
|
return `${timestamp} [${label}] ${level}: ${message}`;
|
||
|
}),
|
||
|
),
|
||
|
}),
|
||
|
],
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export default globals;
|