@@ -49,24 +49,25 @@ impl Context {
49
49
Ok ( _) | Err ( _) => continue ,
50
50
} ;
51
51
52
- let ( name, data_type_str) = split_path ( & root, entry. path ( ) ) ;
53
- if let Some ( info) = templates. get ( & * name) {
54
- warn_ ! ( "Template name '{}' does not have a unique source." , name) ;
55
- match info. path {
56
- Some ( ref path) => info_ ! ( "Existing path: {:?}" , path) ,
57
- None => info_ ! ( "Existing Content-Type: {}" , info. data_type) ,
58
- }
59
-
60
- info_ ! ( "Additional path: {:?}" , entry. path( ) ) ;
61
- warn_ ! ( "Keeping existing template '{}'." , name) ;
52
+ let ( template, data_type_str) = split_path ( & root, entry. path ( ) ) ;
53
+ if let Some ( info) = templates. get ( & * template) {
54
+ warn ! (
55
+ %template,
56
+ first_path = %entry. path( ) . display( ) ,
57
+ second_path = info. path. as_ref( ) . map( |p| display( p. display( ) ) ) ,
58
+ data_type = %info. data_type,
59
+ "Template name '{template}' can refer to multiple templates.\n \
60
+ First path will be used. Second path is ignored."
61
+ ) ;
62
+
62
63
continue ;
63
64
}
64
65
65
66
let data_type = data_type_str. as_ref ( )
66
67
. and_then ( |ext| ContentType :: from_extension ( ext) )
67
68
. unwrap_or ( ContentType :: Text ) ;
68
69
69
- templates. insert ( name , TemplateInfo {
70
+ templates. insert ( template , TemplateInfo {
70
71
path : Some ( entry. into_path ( ) ) ,
71
72
engine_ext : ext,
72
73
data_type,
@@ -75,9 +76,8 @@ impl Context {
75
76
}
76
77
77
78
let mut engines = Engines :: init ( & templates) ?;
78
- if let Err ( e) = callback ( & mut engines) {
79
- error_ ! ( "Template customization callback failed." ) ;
80
- error_ ! ( "{}" , e) ;
79
+ if let Err ( reason) = callback ( & mut engines) {
80
+ error ! ( %reason, "template customization callback failed" ) ;
81
81
return None ;
82
82
}
83
83
@@ -151,9 +151,8 @@ mod manager {
151
151
let watcher = match watcher {
152
152
Ok ( watcher) => Some ( ( watcher, Mutex :: new ( rx) ) ) ,
153
153
Err ( e) => {
154
- warn ! ( "Failed to enable live template reloading: {}" , e) ;
155
- debug_ ! ( "Reload error: {:?}" , e) ;
156
- warn_ ! ( "Live template reloading is unavailable." ) ;
154
+ warn ! ( "live template reloading initialization failed: {e}\n \
155
+ live template reloading is unavailable") ;
157
156
None
158
157
}
159
158
} ;
@@ -182,13 +181,13 @@ mod manager {
182
181
. map ( |( _, rx) | rx. lock ( ) . expect ( "fsevents lock" ) . try_iter ( ) . count ( ) > 0 ) ;
183
182
184
183
if let Some ( true ) = templates_changes {
185
- info_ ! ( "Change detected: reloading templates. " ) ;
184
+ debug ! ( "template change detected: reloading templates" ) ;
186
185
let root = self . context ( ) . root . clone ( ) ;
187
186
if let Some ( new_ctxt) = Context :: initialize ( & root, callback) {
188
187
* self . context_mut ( ) = new_ctxt;
189
188
} else {
190
- warn_ ! ( "An error occurred while reloading templates." ) ;
191
- warn_ ! ( "Existing templates will remain active.") ;
189
+ warn ! ( "error while reloading template \n \
190
+ existing templates will remain active.")
192
191
} ;
193
192
}
194
193
}
0 commit comments