You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
loggerMock.Verify(logger =>logger.WriteInformation("Updated {0} documents",1),"Informational message should indicate how many documents were updated.");
loggerMock.Verify(logger =>logger.WriteInformation("Updated {0} documents",2),Times.Exactly(2),"Informational message should indicate how many documents were updated.");
119
+
loggerMock.Verify(logger =>logger.WriteInformation("Updated {0} documents",1),Times.Once,"Informational message should indicate how many documents were updated.");
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
mockLogger.Verify(logger =>logger.WriteInformation("{0}: Up migration started",typeof(First_Migration).Name),Times.AtLeastOnce,"Informational message should indicate Up migration started.");
305
+
mockLogger.Verify(logger =>logger.WriteInformation("{0}: Up migration completed",typeof(First_Migration).Name),Times.AtLeastOnce,"Informational message should indicate Up migration started.");
mockLogger.Verify(logger =>logger.WriteInformation("{0}: Down migration started",typeof(First_Migration).Name),Times.AtLeastOnce,"Informational message should indicate Up migration started.");
331
+
mockLogger.Verify(logger =>logger.WriteInformation("{0}: Down migration completed",typeof(First_Migration).Name),Times.AtLeastOnce,"Informational message should indicate Up migration started.");
Copy file name to clipboardExpand all lines: readme.md
+32-16Lines changed: 32 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,24 +68,26 @@ After each migration is executed, a document of type **MigrationDocument** is in
68
68
You can modify the runner options by declaring a **MigrationOptions** instance and passing it to the runner.
69
69
70
70
```
71
-
public class MigrationOptions
71
+
public class MigrationOptions
72
+
{
73
+
public MigrationOptions()
72
74
{
73
-
public MigrationOptions()
74
-
{
75
-
Direction = Directions.Up;
76
-
Assemblies = new List<Assembly>();
77
-
Profiles = new List<string>();
78
-
MigrationResolver = new DefaultMigrationResolver();
79
-
Assemblies = new List<Assembly>();
80
-
ToVersion = 0;
81
-
}
82
-
83
-
public Directions Direction { get; set; }
84
-
public IList<Assembly> Assemblies { get; set; }
85
-
public IList<string> Profiles { get; set; }
86
-
public IMigrationResolver MigrationResolver { get; set; }
87
-
public long ToVersion { get; set; }
75
+
Direction = Directions.Up;
76
+
Assemblies = new List<Assembly>();
77
+
Profiles = new List<string>();
78
+
MigrationResolver = new DefaultMigrationResolver();
79
+
Assemblies = new List<Assembly>();
80
+
ToVersion = 0;
81
+
Logger = new ConsoleLogger();
88
82
}
83
+
84
+
public Directions Direction { get; set; }
85
+
public IList<Assembly> Assemblies { get; set; }
86
+
public IList<string> Profiles { get; set; }
87
+
public IMigrationResolver MigrationResolver { get; set; }
88
+
public long ToVersion { get; set; }
89
+
public ILogger Logger { get; set; }
90
+
}
89
91
```
90
92
91
93
### Profiles
@@ -266,6 +268,20 @@ Example usage in a migration:
266
268
}
267
269
```
268
270
271
+
## Logging
272
+
273
+
Specify a logger when configuring the runner.
274
+
275
+
By default the `ConsoleLogger` is used.
276
+
277
+
Implement the `RavenMigrations.ILogger` interface to create your own logger:
278
+
279
+
```
280
+
void WriteInformation(string format, params object[] args);
281
+
void WriteError(string format, params object[] args);
282
+
void WriteWarning(string format, params object[] args);
283
+
```
284
+
269
285
## Integration
270
286
271
287
We suggest you run the migrations at the start of your application to ensure that any new changes you have made apply to your application before you application starts. If you do not want to do it here, you can choose to do it out of band using a seperate application.
0 commit comments