Last active
June 23, 2022 17:47
-
-
Save CCXXXI/b9288c2798bb37b3b056107caa1ba346 to your computer and use it in GitHub Desktop.
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
import { createLogger, format, transports } from "winston"; | |
const logger = createLogger({ | |
level: "debug", | |
transports: [ | |
new transports.Console({ | |
format: format.combine(format.colorize(), format.simple()), | |
}), | |
new transports.File({ | |
filename: "discord-embeds-reader-bot.log", | |
format: format.combine(format.timestamp(), format.json()), | |
}), | |
], | |
}); | |
/** | |
* @see https://stackoverflow.com/a/39914235/13805358 | |
*/ | |
async function sleep(ms) { | |
return new Promise((resolve) => setTimeout(resolve, ms)); | |
} | |
function unique<T>(arr: T[]): T[] { | |
return Array.from(new Set(arr)); | |
} | |
export { logger, sleep, unique }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment