1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-03 23:50:33 +02:00

Chore: Refactor mobile plugin logic into locations more consistent with other parts of the app (#10636)

This commit is contained in:
Henry Heino
2024-06-25 05:59:59 -07:00
committed by GitHub
parent 801d36c41f
commit c7116b135f
34 changed files with 155 additions and 91 deletions

View File

@ -0,0 +1,20 @@
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;