serilog-mssql / serilog-sinks-mssqlserver

A Serilog sink that writes events to Microsoft SQL Server and Azure SQL
Apache License 2.0
283 stars 148 forks source link

Code snippet contains ghost variable in readme.md #408

Closed mperudirectio closed 2 years ago

mperudirectio commented 2 years ago

In this code snippet provided into the principal readme.md:

var logDB = @"Server=...";
var sinkOpts = new MSSqlServerSinkOptions();
sinkOpts.TableName = "Logs";
var columnOpts = new ColumnOptions();
columnOpts.Store.Remove(StandardColumn.Properties);
columnOpts.Store.Add(StandardColumn.LogEvent);
columnOpts.LogEvent.DataLength = 2048;
columnOpts.PrimaryKey = options.TimeStamp;
columnOpts.TimeStamp.NonClusteredIndex = true;

var log = new LoggerConfiguration()
    .WriteTo.MSSqlServer(
        connectionString: logDB,
        sinkOptions: sinkOpts,
        columnOptions: columnOpts
    ).CreateLogger();

the object options, from which options.TimeStamp is derived, it's of unknown type and there is no instance of it in the code snippet.

Can I just know what it's related to? Thank you

UPDATE Calling the variable columnOpts instead of options solved the problem. It is probably just an error due to the wrong name of the variable

ckadluba commented 2 years ago

Hi @mperudirectio!

Thank you for pointing this out. I fixed it in PR #409.

Cheers, Christian!