mirror of
https://github.com/StepanovPlaton/SSAUGenerator.git
synced 2026-11-01 10:49:08 +04:00
first commit
This commit is contained in:
18
src/util/logger.js
Normal file
18
src/util/logger.js
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
function createLogger({ verbose = false } = {}) {
|
||||
const write = (stream, prefix, args) => {
|
||||
stream.write(prefix + args.map(String).join(' ') + '\n');
|
||||
};
|
||||
return {
|
||||
info: (...args) => write(process.stdout, '', args),
|
||||
warn: (...args) => write(process.stderr, 'warning: ', args),
|
||||
error: (...args) => write(process.stderr, 'error: ', args),
|
||||
debug: (...args) => {
|
||||
if (verbose) write(process.stdout, 'debug: ', args);
|
||||
},
|
||||
verbose,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { createLogger };
|
||||
Reference in New Issue
Block a user