-
Notifications
You must be signed in to change notification settings - Fork 43
Providers info
Note: please check Samples and Tests in the repository for additional examples on all configuration options.
// namespace Serilog.Ui.MsSqlServerProvider.Extensions
/// <summary>
/// Use for default columns configuration
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseSqlServer(this ISerilogUiOptionsBuilder optionsBuilder,
Action<RelationalDbOptions> setupOptions,
Func<string, DateTime>? = null);
/// <summary>
/// Use to configure additional columns.
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseSqlServer<T>(this ISerilogUiOptionsBuilder optionsBuilder,
Action<RelationalDbOptions> setupOptions,
Func<string, DateTime>? = null) where T : SqlServerLogModel
T WithConnectionString<T>(this T options, string connectionString) where T : DbOptionsBase;
T WithCustomProviderName<T>(this T options, string customProviderName) where T : DbOptionsBase;
T WithTable<T>(this T options, string tableName) where T : RelationalDbOptions;
T WithSchema<T>(this T options, string schemaName) where T : RelationalDbOptions; // optional, defaults to **dbo**
// namespace Serilog.Ui.MongoDbProvider.Extensions
/// <summary>
/// Action throws if ConnectionString AND CollectionName is null or whitespace.
/// Action throws if DatabaseName is null or whitespace and it is not found in the connection string.
/// </summary>
ISerilogUiOptionsBuilder UseMongoDb(this ISerilogUiOptionsBuilder optionsBuilder, Action<MongoDbOptions> setupOptions);
T WithConnectionString<T>(this T options, string connectionString) where T : DbOptionsBase;
T WithCustomProviderName<T>(this T options, string customProviderName) where T : DbOptionsBase;
MongoDbOptions WithDatabaseName(string databaseName); // optional, if provided in connection string
MongoDbOptions WithCollectionName(string collection);
// namespace Serilog.Ui.MySqlProvider.Extensions
/* using Serilog.Sinks.MySQL */
/// <summary>
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// Default schema name, if not provided, is **dbo**
/// </summary>
ISerilogUiOptionsBuilder UseMySqlServer(this ISerilogUiOptionsBuilder optionsBuilder, Action<RelationalDbOptions> setupOptions);
/* using Serilog.Sinks.MariaDB */
/// <summary>
/// Use for default columns configuration
/// Default schema name, if not provided, is **dbo**
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseMariaDbServer(this ISerilogUiOptionsBuilder optionsBuilder, Action<RelationalDbOptions> setupOptions);
/// <summary>
/// Use to configure additional columns.
/// Default schema name, if not provided, is **dbo**
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseMariaDbServer<T>(this ISerilogUiOptionsBuilder optionsBuilder, Action<RelationalDbOptions> setupOptions) where T : MySqlLogModel;
T WithConnectionString<T>(this T options, string connectionString) where T : DbOptionsBase;
T WithCustomProviderName<T>(this T options, string customProviderName) where T : DbOptionsBase;
T WithTable<T>(this T options, string tableName) where T : RelationalDbOptions;
T WithSchema<T>(this T options, string schemaName) where T : RelationalDbOptions; // optional
/* Available sinks are:
* <a href="https://github.com/serilog-contrib/Serilog.Sinks.Postgresql.Alternative">Serilog.Sinks.Postgresql.Alternative</a>
* <a href="https://github.com/b00ted/serilog-sinks-postgresql">Serilog.Sinks.Postgresql</a>
* We suggest choosing Postgresql.Alternative.
*/
// namespace Serilog.Ui.PostgreSqlProvider.Extensions
/// <summary>
/// Use for default columns configuration
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseNpgSql(this ISerilogUiOptionsBuilder optionsBuilder, Action<PostgreSqlDbOptions> setupOptions);
/// <summary>
/// Use to configure additional columns.
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseNpgSql(this ISerilogUiOptionsBuilder optionsBuilder, Action<PostgreSqlDbOptions> setupOptions) where T : PostgresLogModel;
T WithConnectionString<T>(this T options, string connectionString) where T : DbOptionsBase;
T WithCustomProviderName<T>(this T options, string customProviderName) where T : DbOptionsBase;
T WithTable<T>(this T options, string tableName) where T : RelationalDbOptions;
T WithSchema<T>(this T options, string schemaName) where T : RelationalDbOptions; // optional, defaults to **public**
PostgreSqlDbOptions WithSinkType(PostgreSqlSinkType sinkType);
// namespace Serilog.Ui.SqliteDataProvider.Extensions
/// <summary>
/// Throws if ConnectionString, TableName, Schema is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseSqliteServer(this ISerilogUiOptionsBuilder optionsBuilder,
Action<RelationalDbOptions> setupOptions);
T WithConnectionString<T>(this T options, string connectionString) where T : DbOptionsBase;
T WithCustomProviderName<T>(this T options, string customProviderName) where T : DbOptionsBase;
T WithTable<T>(this T options, string tableName) where T : RelationalDbOptions;
T WithSchema<T>(this T options, string schemaName) where T : RelationalDbOptions; // optional, defaults to **dbo**
// namespace Serilog.Ui.RavenDbProvider.Extensions;
/// <summary>
/// Throws if DocumentStore is null.
/// Throws if DocumentStore.Urls is null or empty.
/// Throws if DocumentStore.Urls is null or empty.
/// Throws if CollectionName is null or whitespace.
/// Throws if DatabaseName is null or whitespace and is not found in the connection string.
/// </summary>
ISerilogUiOptionsBuilder UseRavenDb(this ISerilogUiOptionsBuilder optionsBuilder, Action<RavenDbOptions> setupOptions);
RavenDbOptions WithCustomProviderName(string customProviderName);
RavenDbOptions WithDocumentStore(IDocumentStore documentStore);
RavenDbOptions WithCollectionName(string collectionName); // optional, defaults to **LogEvents**
note: ElasticSearch doesn't offer sort by property and it defaults to sort by Timestamp.
// namespace Serilog.Ui.ElasticSearchProvider.Extensions
/// <summary>
/// Throws if <see cref="Endpoint"/> is null.
/// Throws if <see cref="IndexName"/> is null or whitespace.
/// </summary>
ISerilogUiOptionsBuilder UseElasticSearchDb(this ISerilogUiOptionsBuilder optionsBuilder, Action<ElasticSearchDbOptions> setupOptions);
ElasticSearchDbOptions WithCustomProviderName(string customProviderName)
ElasticSearchDbOptions WithIndex(string indexName);
ElasticSearchDbOptions WithEndpoint(Uri endpoint);
They can be configured for the following providers:
- MsSqlServerProvider
- MySqlProvider (MariaDB sink only)
- PostgreSqlProvider
MongoDb exposes additional columns in the Properties info. RavenDb sink don't expose a way to customize columns.
... that inherits from the Provider Log Model (you can find each provider model down below in the page, specified as a constraint on the provider extension methods that accept a generic parameter).
Currently the columns that can be removed are the Exception and the Properties fields.
To remove them, override the desired property/ies in the custom LogModel and apply it/them the Serilog.Ui.Core.Attributes.RemovedColumn
attribute.
Register any property on the custom LogModel. Currently, the UI offers a specific render for the following property types:
- bool
- DateTime
- Code type (JSON, XML)
- string (default rendering)
To register a code-type column, add the Serilog.Ui.Core.AttributesCodeColumn(codeType: CodeType)
attribute on the property, specifying the type of code to parse (you can choose between JSON and XML).
... providing your custom LogModel as T.
That's it, your additional columns are configured for view in the client app!
Note: the Samples.WebApi project offers a real example on adding additional columns.
To set a specific name for a registered provider, use the relation Provider Options WithCustomProviderName()
method.