mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
logs: allow per-log-channel log formats
This commit is contained in:
parent
8b22ce267d
commit
28de8a592b
3 changed files with 20 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
import { PluginData } from "knub";
|
||||
import { LogsPluginType } from "../types";
|
||||
import { LogsPluginType, TLogFormats } from "../types";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import {
|
||||
verboseUserMention,
|
||||
|
@ -14,9 +14,14 @@ import { renderTemplate, TemplateParseError } from "src/templateFormatter";
|
|||
import { logger } from "src/logger";
|
||||
import moment from "moment-timezone";
|
||||
|
||||
export async function getLogMessage(pluginData: PluginData<LogsPluginType>, type: LogType, data: any): Promise<string> {
|
||||
export async function getLogMessage(
|
||||
pluginData: PluginData<LogsPluginType>,
|
||||
type: LogType,
|
||||
data: any,
|
||||
formats?: TLogFormats,
|
||||
): Promise<string> {
|
||||
const config = pluginData.config.get();
|
||||
const format = config.format[LogType[type]] || "";
|
||||
const format = (formats && formats[LogType[type]]) || config.format[LogType[type]] || "";
|
||||
if (format === "") return;
|
||||
|
||||
const values = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue