Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSsql sink writes times as local time #392 #1

Merged
merged 2 commits into from
Apr 8, 2015

Conversation

the-dwyer
Copy link
Contributor

Hi,

Here is an implementation for the requested enhancement.

Let me know what you think.

Thanks,

Michael

@@ -45,14 +46,14 @@ public static class LoggerConfigurationMSSqlServerExtensions
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = MSSqlServerSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
IFormatProvider formatProvider = null)
IFormatProvider formatProvider = null, bool utcTimestamp = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By forcing it to true, you do change the default behaviour. Would an opt in not be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for an opt-in, plus it's convention throughout Serilog that optional Booleans default to false, so helps there too.

Also missing a carriage return to keep the formatting clean in this parameter list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, perhaps we could name it more specifically - something like storeTimestampInUtc? The current name at first glance sounds like it is the timestamp. :-)

@nblumhardt
Copy link
Contributor

Looks good to me, just some minor issues mentioned in the comments.

We will also need to version this as 2.0, because the API of the MSSqlServer() method won't be binary-compatible with the old one. (We used to consider source-compatibility the bar for configuration changes, but since it's now cheap to increment sink versions separately, we might as well be more stringent).

Cheers!

@nblumhardt
Copy link
Contributor

Thanks, this looks great, let's kick it off!

nblumhardt added a commit that referenced this pull request Apr 8, 2015
MSsql sink writes times as local time #392
@nblumhardt nblumhardt merged commit 9125f58 into serilog-mssql:master Apr 8, 2015
mivano pushed a commit that referenced this pull request Apr 21, 2018
* Updated reference to Serilog version 2.5.0 as suggested in #110
* Added a new Sink `MSSqlServerAuditSink` that persists LogEvents to the database immediately and propagates any errors that occur.
* Moved, and refactored common functionality from `MSSqlServerSink` into `MSSqlServerSinkTraits` which is now used by both sinks.
nblumhardt pushed a commit that referenced this pull request Apr 20, 2019
…ormat

Make sure the JSON has a valid structure.
ckadluba referenced this pull request in ckadluba/serilog-sinks-mssqlserver Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants