Skip to content

Commit 0e400a3

Browse files
committed
docs: extend lazytail init template with renderer and theme examples
Add commented sections for theme selection (built-in + import command) and renderer presets (parser, layout fields, severity/status_code styles, style_map, format, _rest) to the generated lazytail.yaml template.
1 parent bdca5f1 commit 0e400a3

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

src/cli/init.rs

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,41 @@ fn generate_config_template(project_name: &str) -> String {
7171
# Project name (optional, defaults to directory name)
7272
name: {project_name}
7373
74+
# Theme: built-in 'dark' (default) or 'light'
75+
# Import from terminal emulators: lazytail theme import <file>
76+
# Supports: Windows Terminal, Alacritty, iTerm2, Ghostty
77+
# theme: dark
78+
79+
# Rendering presets for structured log lines
80+
# Built-in renderers: 'json', 'logfmt' (auto-detected)
81+
# renderers:
82+
# - name: app-logs
83+
# parser: json # json, logfmt, regex, or auto
84+
# layout:
85+
# - field: timestamp
86+
# style: dim
87+
# format: datetime:relative # datetime, duration, bytes
88+
# - field: level
89+
# style: severity # auto-colors error/warn/info/debug
90+
# width: 5 # fixed column width
91+
# - field: status
92+
# style: status_code # auto-colors HTTP 2xx/3xx/4xx/5xx
93+
# - field: message
94+
# max_width: 120 # truncate long values
95+
# - field: environment
96+
# style_map: # map values to colors
97+
# production: red
98+
# staging: yellow
99+
# _default: dim
100+
# - field: _rest # all remaining fields
101+
# style: dim
102+
74103
# Log sources to display in the viewer
104+
# Captured sources (via 'cmd | lazytail -n NAME') appear automatically
75105
# sources:
76-
# - name: api # Display name shown in tabs
106+
# - name: api # display name shown in tabs
77107
# path: /var/log/api.log
108+
# renderers: [app-logs] # apply specific renderers
78109
# - name: worker
79110
# path: ~/logs/worker.log
80111
"#,
@@ -98,4 +129,19 @@ mod tests {
98129
assert!(content.contains("# sources:"));
99130
assert!(content.contains("# - name: api"));
100131
}
132+
133+
#[test]
134+
fn test_generate_config_template_has_renderer_section() {
135+
let content = generate_config_template("test");
136+
assert!(content.contains("# renderers:"));
137+
assert!(content.contains("# parser: json"));
138+
assert!(content.contains("style: severity"));
139+
}
140+
141+
#[test]
142+
fn test_generate_config_template_has_theme_section() {
143+
let content = generate_config_template("test");
144+
assert!(content.contains("# theme: dark"));
145+
assert!(content.contains("lazytail theme import"));
146+
}
101147
}

0 commit comments

Comments
 (0)