Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
268 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using Marten; | ||
using Marten.Services; | ||
using Npgsql; | ||
|
||
namespace MartenWebApp | ||
{ | ||
public class WebConsoleMartenLogger : IMartenLogger, IMartenSessionLogger | ||
{ | ||
public IMartenSessionLogger StartSession(IQuerySession session) | ||
{ | ||
return (IMartenSessionLogger)this; | ||
} | ||
|
||
public void SchemaChange(string sql) | ||
{ | ||
Debug.WriteLine("Executing DDL change:"); | ||
Debug.WriteLine(sql); | ||
Debug.WriteLine(" "); | ||
} | ||
|
||
public void LogSuccess(NpgsqlCommand command) | ||
{ | ||
Debug.WriteLine(command.CommandText); | ||
} | ||
|
||
public void LogFailure(NpgsqlCommand command, Exception ex) | ||
{ | ||
Debug.WriteLine("Postgresql command failed!"); | ||
Debug.WriteLine(command.CommandText); | ||
Debug.WriteLine((object)ex); | ||
} | ||
|
||
public void RecordSavedChanges(IDocumentSession session, IChangeSet commit) | ||
{ | ||
IChangeSet changeSet = commit; | ||
Debug.WriteLine(string.Format("Persisted {0} updates, {1} inserts, and {2} deletions", (object)changeSet.Updated.Count<object>(), (object)changeSet.Inserted.Count<object>(), (object)changeSet.Deleted.Count<IDeletion>())); | ||
} | ||
} | ||
} |