diff --git a/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts index 9129f7c3d85..dbf274e51bc 100644 --- a/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts @@ -41,6 +41,7 @@ export interface Options { showLogContextToggle: boolean; showTime: boolean; sortOrder: common.LogsSortOrder; + syntaxHighlighting?: boolean; wrapLogMessage: boolean; } diff --git a/public/app/plugins/panel/logs/LogsPanel.tsx b/public/app/plugins/panel/logs/LogsPanel.tsx index b1b6a1a8285..a55bdd30a46 100644 --- a/public/app/plugins/panel/logs/LogsPanel.tsx +++ b/public/app/plugins/panel/logs/LogsPanel.tsx @@ -152,6 +152,7 @@ export const LogsPanel = ({ enableInfiniteScrolling, onNewLogsReceived, fontSize, + syntaxHighlighting, ...options }, id, @@ -568,7 +569,7 @@ export const LogsPanel = ({ showTime={showTime} sortOrder={sortOrder} logOptionsStorageKey={storageKey} - syntaxHighlighting={prettifyLogMessage} + syntaxHighlighting={syntaxHighlighting} timeRange={data.timeRange} timeZone={timeZone} wrapLogMessage={wrapLogMessage} diff --git a/public/app/plugins/panel/logs/module.tsx b/public/app/plugins/panel/logs/module.tsx index 5ee555bb09a..da674495d77 100644 --- a/public/app/plugins/panel/logs/module.tsx +++ b/public/app/plugins/panel/logs/module.tsx @@ -30,19 +30,29 @@ export const plugin = new PanelPlugin(LogsPanel) }); } - builder - .addBooleanSwitch({ - path: 'wrapLogMessage', - name: 'Wrap lines', - description: '', - defaultValue: false, - }) - .addBooleanSwitch({ + builder.addBooleanSwitch({ + path: 'wrapLogMessage', + name: 'Wrap lines', + description: '', + defaultValue: false, + }); + + if (config.featureToggles.newLogsPanel) { + builder.addBooleanSwitch({ + path: 'syntaxHighlighting', + name: 'Enable syntax highlighting', + description: 'Use a predefined syntax coloring grammar to highlight relevant parts of the log lines', + }); + } else { + builder.addBooleanSwitch({ path: 'prettifyLogMessage', - name: config.featureToggles.newLogsPanel ? 'Enable log message highlighting' : 'Prettify JSON', + name: 'Prettify JSON', description: '', defaultValue: false, - }) + }); + } + + builder .addBooleanSwitch({ path: 'enableLogDetails', name: 'Enable log details', diff --git a/public/app/plugins/panel/logs/panelcfg.cue b/public/app/plugins/panel/logs/panelcfg.cue index 821bc66321a..cd21fc2e041 100644 --- a/public/app/plugins/panel/logs/panelcfg.cue +++ b/public/app/plugins/panel/logs/panelcfg.cue @@ -35,6 +35,7 @@ composableKinds: PanelCfg: { wrapLogMessage: bool prettifyLogMessage: bool enableLogDetails: bool + syntaxHighlighting?: bool sortOrder: common.LogsSortOrder dedupStrategy: common.LogsDedupStrategy enableInfiniteScrolling?: bool diff --git a/public/app/plugins/panel/logs/panelcfg.gen.ts b/public/app/plugins/panel/logs/panelcfg.gen.ts index 9a9a47b82d1..5af4d61f578 100644 --- a/public/app/plugins/panel/logs/panelcfg.gen.ts +++ b/public/app/plugins/panel/logs/panelcfg.gen.ts @@ -39,6 +39,7 @@ export interface Options { showLogContextToggle: boolean; showTime: boolean; sortOrder: common.LogsSortOrder; + syntaxHighlighting?: boolean; wrapLogMessage: boolean; }