-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ResetEvent, introduced Configuration and refactor
- Loading branch information
Showing
9 changed files
with
266 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
namespace NHibernate.ZMQLogPublisher | ||
{ | ||
using System.Collections.Generic; | ||
|
||
public class Configuration | ||
{ | ||
public SocketConfiguration SyncSocketConfig { get; set; } | ||
|
||
public SocketConfiguration PublisherSocketConfig { get; set; } | ||
|
||
public List<string> LoggersToPublish { get; set; } | ||
|
||
public static Configuration LoadDefault() | ||
{ | ||
var config = new Configuration(); | ||
config.SyncSocketConfig = new SocketConfiguration { Address = "tcp://*:68747" }; | ||
config.PublisherSocketConfig = new SocketConfiguration { Address = "tcp://*:68748" }; | ||
config.LoggersToPublish = new List<string> | ||
{ | ||
"NHibernate.SQL", "NHibernate.Impl.SessionImpl", "NHibernate.Transaction.AdoTransaction", | ||
"NHibernate.AdoNet.AbstractBatcher" | ||
}; | ||
|
||
return config; | ||
} | ||
|
||
public Configuration AddLoggerKeyToPublish(string key) | ||
{ | ||
if (!LoggersToPublish.Contains(key)) | ||
{ | ||
LoggersToPublish.Add(key); | ||
} | ||
|
||
return this; | ||
} | ||
|
||
public Configuration ConfigureSyncSocket(System.Action<SocketConfiguration> socketConfigAction) | ||
{ | ||
socketConfigAction(this.SyncSocketConfig); | ||
|
||
return this; | ||
} | ||
|
||
public Configuration ConfigurePublisherSocket(System.Action<SocketConfiguration> socketConfigAction) | ||
{ | ||
socketConfigAction(this.PublisherSocketConfig); | ||
|
||
return this; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.