本文整理汇总了C#中ILoggerRepository.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ILoggerRepository.Get方法的具体用法?C# ILoggerRepository.Get怎么用?C# ILoggerRepository.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILoggerRepository
的用法示例。
在下文中一共展示了ILoggerRepository.Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DekiInstance
//--- Constructor ---
internal DekiInstance(DekiWikiService deki, string id, XDoc instanceConfig, ILicenseController licenseController) {
if(deki == null) {
throw new ArgumentNullException("deki");
}
if(string.IsNullOrEmpty(id)) {
throw new ArgumentNullException("id");
}
this.Id = id;
// Note (arnec): this is now the the third place we define a wikiid based logger repository, however constructors interdependencies
// currently neccessitates this duplication, and fortunately it is mostly an aesthetic issue.
_loggerRepository = new ContextLoggerRepository("[" + Id + "] ");
_log = _loggerRepository.Get(GetType());
this.TimerFactory = TaskTimerFactory.Create(this);
this.Cache = new DreamCache(TimerFactory);
var cacheFactory = new InMemoryKeyValueCacheFactory(TimerFactory);
var searchSerializer = new SearchSerializer();
cacheFactory.SetSerializer<SearchResult>(searchSerializer);
cacheFactory.SetSerializer<SearchResultDetail>(searchSerializer);
this.SearchCache = cacheFactory.Create();
this.Config = instanceConfig;
_licenseController = licenseController;
this.Log = LogManager.GetLogger(deki.GetType().Name + "_" + id);
_deki = deki;
_status = DekiInstanceStatus.CREATED;
_apiKey = Config[ConfigBL.SECURITY_APIKEY].AsText;
foreach(XDoc hostDoc in Config["host"]) {
string host = hostDoc.Contents;
if(!StringUtil.EqualsInvariantIgnoreCase(host, "*")) {
string port = hostDoc["@port"].AsText;
string scheme = hostDoc["@https"].AsBool.GetValueOrDefault() ? "https://" : "http://";
string uri = scheme + host + (string.IsNullOrEmpty(port) ? "" : ":" + port);
_canonicalUri = new XUri(uri);
_log.DebugFormat("divined canonical use from hosts as {0}", _canonicalUri);
break;
}
}
if(_canonicalUri == null) {
// Note (arnec): this is a best guess fallback. It will only work in these scenarios:
// a) The host was set up with a uri.public that has ends in @api and with the @api points to the site uri, or
// b) The api lives on the same machine as the site, so that deriving uri.public for the host from the machine
// IP happens to point to the same machine
// Either way it relies on the hard-coded assumption that the api is accessible via {site}/@api
_canonicalUri = DreamContext.Current.ServerUri;
if(_canonicalUri.LastSegment.EqualsInvariantIgnoreCase("@api")) {
_canonicalUri = _canonicalUri.WithoutLastSegment();
}
_log.DebugFormat("using server uri as canonical uri: {0}", _canonicalUri);
} else {
// Note (arnec): Propagating a much hard-coded assumption, i.e. that the Api for any Deki instance can be accessed
// at the instances' canonical uri plus @api
// register the api uri with the dream host so that requests originating from within Dream are guaranteed to be locally routed
_deki.Env.At("status", "aliases").Post(new XDoc("aliases").Elem("uri.alias", _canonicalUri.At("@api")), new Result<DreamMessage>());
}
}