mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
better logging
This commit is contained in:
parent
37b7410453
commit
51aa80cfd9
@ -2,11 +2,20 @@ export { attachConsole as setup } from "tauri-plugin-log-api";
|
||||
|
||||
import * as log from "tauri-plugin-log-api";
|
||||
|
||||
export const debug = (...args: any[]) =>
|
||||
log.debug(args.map((argument) => JSON.stringify(argument)).join(" "));
|
||||
const toString = (value: any) => {
|
||||
if (value instanceof Error) {
|
||||
return value.message;
|
||||
} else if (typeof value === "object") {
|
||||
return JSON.stringify(value);
|
||||
} else {
|
||||
return value.toString();
|
||||
}
|
||||
};
|
||||
|
||||
export const info = (...args: any[]) =>
|
||||
log.info(args.map((argument) => JSON.stringify(argument)).join(" "));
|
||||
export const debug = (...args: any[]) =>
|
||||
log.debug(args.map(toString).join(" "));
|
||||
|
||||
export const info = (...args: any[]) => log.info(args.map(toString).join(" "));
|
||||
|
||||
export const error = (...args: any[]) =>
|
||||
log.error(args.map((argument) => JSON.stringify(argument)).join(" "));
|
||||
log.error(args.map(toString).join(" "));
|
||||
|
Loading…
Reference in New Issue
Block a user