Skip to content

Commit ed7c143

Browse files
committed
Use short name instead of IL generated name.
Fixes Issue#670
1 parent 3ac8d3f commit ed7c143

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/WebJobs.Script/Diagnostics/FastLogger.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,26 @@ public FastLogger(string accountConnectionString)
2727
this._writer = LogFactory.NewWriter(containerName, table);
2828
}
2929

30+
31+
// SDK notification gives us the full name, which came from Ref.Emit.
32+
// It's 'Type.Method'. We just want 'Method'
33+
static string GetShortName(string fullname)
34+
{
35+
int i = fullname.LastIndexOf('.');
36+
if (i != -1)
37+
{
38+
return fullname.Substring(i + 1);
39+
}
40+
return fullname;
41+
}
42+
3043
public async Task AddAsync(FunctionInstanceLogEntry item, CancellationToken cancellationToken = default(CancellationToken))
3144
{
3245
// Convert Host to Protocol so we can log it
3346
var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
3447
var jsonClone = JsonConvert.SerializeObject(item, settings);
3548
var item2 = JsonConvert.DeserializeObject<FunctionInstanceLogItem>(jsonClone);
49+
item2.FunctionName = GetShortName(item2.FunctionName);
3650
await _writer.AddAsync(item2);
3751
}
3852

0 commit comments

Comments
 (0)