forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
37
Kha/Tools/khamake/src/log.ts
Normal file
37
Kha/Tools/khamake/src/log.ts
Normal file
@ -0,0 +1,37 @@
|
||||
let myInfo = function (text: string, newline: boolean) {
|
||||
if (newline) {
|
||||
console.log(text);
|
||||
}
|
||||
else {
|
||||
process.stdout.write(text);
|
||||
}
|
||||
};
|
||||
|
||||
let myError = function (text: string, newline: boolean) {
|
||||
if (newline) {
|
||||
console.error(text);
|
||||
}
|
||||
else {
|
||||
process.stderr.write(text);
|
||||
}
|
||||
};
|
||||
|
||||
export function set(log: {info: (text: string, newline: boolean) => void, error: (text: string, newline: boolean) => void}) {
|
||||
myInfo = log.info;
|
||||
myError = log.error;
|
||||
}
|
||||
|
||||
export function silent(showErrors: boolean = false) {
|
||||
myInfo = function () {};
|
||||
if (!showErrors) {
|
||||
myError = function () {};
|
||||
}
|
||||
}
|
||||
|
||||
export function info(text: string, newline: boolean = true) {
|
||||
myInfo(text, newline);
|
||||
}
|
||||
|
||||
export function error(text: string, newline: boolean = true) {
|
||||
myError(text, newline);
|
||||
}
|
Reference in New Issue
Block a user