2020-07-28 07:39:54 +00:00
|
|
|
/**
|
|
|
|
* Constructs a log transport object for use with external API.
|
|
|
|
*
|
|
|
|
* @param {Array} levels - The log levels forwarded to the external API.
|
|
|
|
|
|
|
|
* @returns {Object} - The transport object.
|
|
|
|
*/
|
|
|
|
function buildTransport(levels: Array<string>) {
|
2022-08-04 08:51:33 +00:00
|
|
|
return levels.reduce((logger: any, level) => {
|
|
|
|
logger[level] = (...args: any) => {
|
2020-07-28 07:39:54 +00:00
|
|
|
APP.API.notifyLog(level, args);
|
|
|
|
};
|
|
|
|
|
|
|
|
return logger;
|
|
|
|
}, {});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default buildTransport;
|