1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00
joplin/packages/app-mobile/plugins/PluginRunner/utils/createOnLogHandler.ts
Henry Heino 55cafb8891
Android: Add support for Markdown editor plugins (#10086)
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
2024-03-11 15:02:15 +00:00

21 lines
606 B
TypeScript

import Plugin from '@joplin/lib/services/plugins/Plugin';
import { LoggerWrapper } from '@joplin/utils/Logger';
import { LogLevel } from '../types';
const createOnLogHander = (plugin: Plugin, pluginLogger: LoggerWrapper) => {
return async (level: LogLevel, message: string) => {
if (level === LogLevel.Info) {
pluginLogger.info(message);
} else if (level === LogLevel.Warn) {
pluginLogger.warn(message);
} else if (level === LogLevel.Error) {
pluginLogger.error(message);
plugin.hasErrors = true;
} else {
pluginLogger.debug(message);
}
};
};
export default createOnLogHander;