@@ -23,16 +23,11 @@ public abstract class FunctionInvokerBase : IFunctionInvoker, IDisposable
23
23
private bool _disposed = false ;
24
24
private IDisposable _fileChangeSubscription ;
25
25
26
- internal FunctionInvokerBase ( ScriptHost host , FunctionMetadata functionMetadata )
27
- : this ( host , functionMetadata , new FunctionLogger ( host , functionMetadata . Name ) )
28
- {
29
- }
30
-
31
- internal FunctionInvokerBase ( ScriptHost host , FunctionMetadata functionMetadata , FunctionLogger logInfo )
26
+ internal FunctionInvokerBase ( ScriptHost host , FunctionMetadata functionMetadata , string logDirName = null )
32
27
{
33
28
Host = host ;
34
29
Metadata = functionMetadata ;
35
- LogInfo = logInfo ;
30
+ FunctionLogger = new FunctionLogger ( host , logDirName ?? functionMetadata . Name ) ;
36
31
}
37
32
38
33
protected static IDictionary < string , object > PrimaryHostTraceProperties { get ; }
@@ -46,15 +41,15 @@ internal FunctionInvokerBase(ScriptHost host, FunctionMetadata functionMetadata,
46
41
47
42
public ScriptHost Host { get ; }
48
43
49
- public FunctionLogger LogInfo { get ; }
44
+ public FunctionLogger FunctionLogger { get ; }
50
45
51
46
public FunctionMetadata Metadata { get ; }
52
47
53
- protected TraceWriter TraceWriter => LogInfo . TraceWriter ;
48
+ protected TraceWriter TraceWriter => FunctionLogger . TraceWriter ;
54
49
55
- protected ILogger Logger => LogInfo . Logger ;
50
+ protected ILogger Logger => FunctionLogger . Logger ;
56
51
57
- public TraceWriter FileTraceWriter => LogInfo . FileTraceWriter ;
52
+ public TraceWriter FileTraceWriter => FunctionLogger . FileTraceWriter ;
58
53
59
54
/// <summary>
60
55
/// All unhandled invocation exceptions will flow through this method.
@@ -70,7 +65,7 @@ public virtual void OnError(Exception ex)
70
65
71
66
protected virtual void TraceError ( string errorMessage )
72
67
{
73
- LogInfo . TraceError ( errorMessage ) ;
68
+ FunctionLogger . TraceError ( errorMessage ) ;
74
69
}
75
70
76
71
protected bool InitializeFileWatcherIfEnabled ( )
@@ -155,7 +150,7 @@ internal void TraceCompilationDiagnostics(ImmutableArray<Diagnostic> diagnostics
155
150
return ;
156
151
}
157
152
158
- TraceWriter traceWriter = LogInfo . TraceWriter ;
153
+ TraceWriter traceWriter = FunctionLogger . TraceWriter ;
159
154
IDictionary < string , object > properties = PrimaryHostTraceProperties ;
160
155
161
156
if ( ! logTarget . HasFlag ( LogTargets . User ) )
@@ -208,7 +203,7 @@ protected virtual void Dispose(bool disposing)
208
203
{
209
204
_fileChangeSubscription ? . Dispose ( ) ;
210
205
211
- ( LogInfo . TraceWriter as IDisposable ) ? . Dispose ( ) ;
206
+ FunctionLogger . Dispose ( ) ;
212
207
}
213
208
214
209
_disposed = true ;
0 commit comments