Skip to content

Commit 6075227

Browse files
committed
Added template src logging
1 parent 331c1dd commit 6075227

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Templates/CSharp/Base/SharedCSharp.template.tt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,26 @@
55
CustomT4Host host = (CustomT4Host)Host;
66
OdcmModel model = host.CurrentModel;
77
var writer = (CodeWriterCSharp)host.CodeWriter;
8+
bool logTemplateSrc = false;
9+
810
#>
911
<#=writer.WriteHeader()#>
1012

1113
// **NOTE** This file was generated by a tool and any changes will be overwritten.
12-
14+
<# if (logTemplateSrc) { #>
15+
// Template Source: <#= TemplateName(host.TemplateFile) #>
16+
<# } #>
1317
<#+
1418

19+
/// <summary>
20+
/// Get the name of the current template being processed
21+
/// </summary>
22+
/// <param name="templateFile">The full path of the current template</param>
23+
/// <returns>The template name, relative to the Templates directory.</returns>
24+
public string TemplateName(string templateFile) {
25+
return templateFile.Substring(templateFile.LastIndexOf("Templates"));
26+
}
27+
1528
// -------------------------------------------------------------
1629
// Methods to retrieve name strings from various Odcm types
1730
// -------------------------------------------------------------

0 commit comments

Comments
 (0)