我目前使用serilog.sinks.sqlite写入sqlite db文件。这可以正常工作,但是我想在此DB文件中创建自定义列。我已经设法用各种富集器(ProcessName,EnviroMentName等)丰富了属性列,但是我需要符合特定的列格式。
我找不到此软件包上的任何有价值的文档。如何创建这些自定义列?
替代解决方案:
如何配置(已记录的大量记录)MSSQL接收器以写入SQLite文件?
提前致谢!
Im currently writing to a SQLite db file using Serilog.Sinks.SqLite. This works fine however i would like to create custom columns in this db file. I have managed to Enrich the properties column with various enrichers (ProcessName, EnviromentName etc) but i need to conform to a specific column format.
I cant find any worthwhile documentation on this package. How would one go about creating these custom columns?
Alternative solution:
How can i configure the (much beter documented) MSSQL sink to write to an SQLite file?
Thanks in advance!
发布评论
评论(1)
有点晚了,但我会回答。
您可以从 serilog.sinks.sqlite 。
在您的解决方案中,删除了
serilog.sinks.sqlite
dll的引用后,您可以将参考添加到下载的项目中。在新的源代码中,您可以访问
sqlitesink.cs
文件,并根据需要修改以下方法:createTable
:您可以定义列createSqlinSertCommand
:设置插入命令以下按下表定义writetodatabasync
:定义插入命令的参数值It's a bit late but I'll give my answer.
You can download the source code of
Serilog.Sinks.SqLite
from github.In your solution, after removing the reference of
Serilog.Sinks.SQLite
dll you have, you can add the reference to the downloaded project.In the new source code you can access the
SQLiteSink.cs
file and modify the following method per your needs:CreateTable
: you can define your columnsCreateSqlInsertCommand
: set the INSERT command following the table definitionWriteToDatabaseAsync
: define the parameter values for your INSERT command