语言

DbContextLoggerOptions 枚举

定义

用于 Microsoft.EntityFrameworkCore.Diagnostics.Internal.FormattingDbContextLogger 和 LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>). 的格式设置选项。

此枚举支持其成员值的按位组合。

[System.Flags]
public enum DbContextLoggerOptions
[<System.Flags>]
type DbContextLoggerOptions = 
Public Enum DbContextLoggerOptions
继承
DbContextLoggerOptions
特性

字段

名称 值 说明
None 0

没有其他元数据或格式的原始日志消息。

SingleLine 1

每个事件只会占用日志中的一行。 默认情况下使用多行。

Level 2

在每个日志消息中包含事件 LogLevel 。 该级别默认包含。

Category 4

在每个消息中包含事件 DbLoggerCategory 。 默认情况下包含该类别。

Id 8

包括每条消息中的内容 EventId 。 事件 ID 默认包含。

UtcTime 16

在每个邮件中包含 UTC 时间戳。 本地时间默认包含。 用于 DefaultWithUtcTime 包括所有默认选项,但将时间戳更改为 UTC。

DefaultWithUtcTime 30

与使用的 LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>)默认值相同,但带有 UTC 时间戳。

包括 Level, Category, Id, UtcTime。

LocalTime 32

在每个消息中包含本地时间时间戳。 本地时间默认包含。

DefaultWithLocalTime 46

使用的 LogTo(Action<String>, LogLevel, Nullable<DbContextLoggerOptions>)默认值。

包括 Level, Category, Id, LocalTime。

注解

有关详细信息和示例,请参阅 EF Core 简单日志记录 。

适用于