本文整理汇总了C#中ILogger.WriteWarning方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.WriteWarning方法的具体用法?C# ILogger.WriteWarning怎么用?C# ILogger.WriteWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.WriteWarning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetScripts
/// <summary>
/// Returns a list of all the persistent migration script file paths sorted by name.
/// </summary>
public IEnumerable<string> GetScripts(ILogger logger)
{
IEnumerable<string> scriptPaths = GetPaths();
IEnumerable<string> scripts = Enumerable.Empty<string>();
foreach (var path in scriptPaths)
{
if (Directory.Exists(path))
{
scripts = scripts.Union(Directory.GetFiles(path, ScriptFileNamePattern));
}
else
{
logger.WriteWarning("WARNING: Persistent migration script directory does not exist.{1}Check the config settings or create the directory. [Path: {0}]", path, Environment.NewLine);
}
}
if (scriptPaths.Count() == 0)
{
logger.WriteWarning("WARNING: No persistent migration script paths are defined.{1}Add a '{0}' appSetting with a semicolon delimited list of paths to use.", PerptualMigrationFoldersAppSetting, Environment.NewLine);
}
return scripts;
}
示例2: GetPath
/// <summary>
/// Returns the seed script path from the
/// config file (if available) or the default path.
/// </summary>
public string GetPath(ILogger log)
{
string path = _configurationManager.AppSettings[AppSettingKeys.SeedFolder];
if (string.IsNullOrEmpty(path))
{
if (log != null)
{
log.WriteWarning(
"The " + AppSettingKeys.SeedFolder + " setting was not present in the configuration file so the default " +
DefaultSeedScriptPath + " folder will be used instead.");
}
path = DefaultSeedScriptPath;
}
VerifyAndCreatePath(path);
return path;
}
示例3: ValidateCorrelationId
protected bool ValidateCorrelationId(AuthenticationExtra extra, ILogger logger)
{
var correlationKey = Constants.CorrelationPrefix + BaseOptions.AuthenticationType;
string correlationCookie;
if (!Request.GetCookies().TryGetValue(
correlationKey,
out correlationCookie))
{
logger.WriteWarning(string.Format("{0} cookie not found", correlationKey));
return false;
}
Response.DeleteCookie(correlationKey);
string correlationExtra;
if (!extra.Properties.TryGetValue(
correlationKey,
out correlationExtra))
{
logger.WriteWarning(string.Format("{0} state property not found", correlationKey));
return false;
}
extra.Properties.Remove(correlationKey);
if (!string.Equals(correlationCookie, correlationExtra, StringComparison.Ordinal))
{
logger.WriteWarning(string.Format("{0} correlation cookie and state property mismatch", correlationKey));
return false;
}
return true;
}
示例4: ValidateCorrelationId
protected bool ValidateCorrelationId(AuthenticationProperties properties, ILogger logger)
{
if (properties == null)
{
throw new ArgumentNullException("properties");
}
string correlationKey = Constants.CorrelationPrefix + BaseOptions.AuthenticationType;
string correlationCookie = Request.Cookies[correlationKey];
if (string.IsNullOrWhiteSpace(correlationCookie))
{
logger.WriteWarning("{0} cookie not found.", correlationKey);
return false;
}
Response.Cookies.Delete(correlationKey);
string correlationExtra;
if (!properties.Dictionary.TryGetValue(
correlationKey,
out correlationExtra))
{
logger.WriteWarning("{0} state property not found.", correlationKey);
return false;
}
properties.Dictionary.Remove(correlationKey);
if (!string.Equals(correlationCookie, correlationExtra, StringComparison.Ordinal))
{
logger.WriteWarning("{0} correlation cookie and state property mismatch.", correlationKey);
return false;
}
return true;
}