mirror of
https://github.com/bitwarden/server.git
synced 2025-02-02 23:41:21 +01:00
include project property with logs
This commit is contained in:
parent
8edba6bb6c
commit
e51cf078b0
@ -16,6 +16,7 @@ namespace Bit.Admin.Models
|
||||
public string MessageTemplate { get; set; }
|
||||
public Error Exception { get; set; }
|
||||
public IDictionary<string, object> Properties { get; set; }
|
||||
public string Project => Properties?.ContainsKey("Project") ?? false ? Properties["Project"].ToString() : null;
|
||||
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class Error : Exception, ISerializable
|
||||
|
@ -13,6 +13,7 @@
|
||||
<tr>
|
||||
<th style="width: 50px;"> </th>
|
||||
<th style="width: 200px;">Timestamp</th>
|
||||
<th style="width: 100px;">Project</th>
|
||||
<th style="width: 100px;">Level</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
@ -21,7 +22,7 @@
|
||||
@if(!Model.Items.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="4">No results to list.</td>
|
||||
<td colspan="5">No results to list.</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
@ -35,6 +36,7 @@
|
||||
</a>
|
||||
</td>
|
||||
<td>@log.Timestamp.ToString()</td>
|
||||
<td>@(string.IsNullOrWhiteSpace(log.Project) ? "-" : log.Project)</td>
|
||||
<td>@log.Level</td>
|
||||
<td>@log.MessageTruncated</td>
|
||||
</tr>
|
||||
|
@ -35,7 +35,9 @@ namespace Bit.Core.Utilities
|
||||
CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Key))
|
||||
{
|
||||
config.WriteTo.AzureDocumentDB(new Uri(globalSettings.DocumentDb.Uri),
|
||||
globalSettings.DocumentDb.Key, timeToLive: TimeSpan.FromDays(7));
|
||||
globalSettings.DocumentDb.Key, timeToLive: TimeSpan.FromDays(7))
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithProperty("Project", globalSettings.ProjectName);
|
||||
}
|
||||
else if(CoreHelpers.SettingHasValue(globalSettings?.Sentry.Dsn))
|
||||
{
|
||||
@ -49,7 +51,9 @@ namespace Bit.Core.Utilities
|
||||
}
|
||||
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
|
||||
{
|
||||
config.WriteTo.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt");
|
||||
config.WriteTo.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt")
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithProperty("Project", globalSettings.ProjectName);
|
||||
}
|
||||
|
||||
var serilog = config.CreateLogger();
|
||||
|
Loading…
Reference in New Issue
Block a user