add logging in load_templates

This commit is contained in:
guochao 2024-03-06 11:07:04 +08:00
parent d75da67690
commit ea4217f197
Signed by: guochao
GPG Key ID: 79F7306D2AA32FC3

View File

@ -11,13 +11,12 @@ pub fn load_templates() -> Result<tera::Tera, Box<dyn std::error::Error>> {
.map(|s| s.to_string())
.collect();
for entry in TEMPLATES_DIR.find("**/*.html")? {
tracing::info!(path=entry.path().to_str().unwrap_or_default(), "found embeded template");
if let Some(file) = entry.as_file() {
let path = file.path();
let path = path.to_string_lossy().to_string();
if template_names.contains(&path) {
continue;
}
if let Some(content) = file.contents_utf8() {
tracing::info!(path=entry.path().to_str().unwrap_or_default(), "added embeded template");
templates.add_raw_template(&path, content)?;
}
}