예제 #1
0
 /// <summary>
 /// Log security concerns to a file
 /// </summary>
 /// <param name="details"></param>
 public static void LogSecurityConcern(string details, IwsDiagnostics.SecurityConcernLevel concernLevel)
 {
     if (AppSettings.DiagnosticsWriteSecurityConcernsToFile)
     {
         try
         {
             //Put it in a file
             LogSecurityConcernToFile(details, concernLevel);
         }
         catch
         {
             //Something happened trying to write out the file contents... march on.
         }
     }
 }
예제 #2
0
    /// <summary>
    /// Logs security concern data into a date names file on the local file system
    /// </summary>
    /// <param name="details"></param>
    private static void LogSecurityConcernToFile(string details, IwsDiagnostics.SecurityConcernLevel concernLevel)
    {
        var dateTimeNow = DateTime.UtcNow;
        var sb          = new StringBuilder();

        //If the concern level is high, note it
        if (concernLevel == IwsDiagnostics.SecurityConcernLevel.High)
        {
            sb.AppendLine("Security concern level: HIGH-CONCERN");
        }

        sb.Append("Security concern timestamp: ");
        sb.AppendLine(dateTimeNow.ToString());

        sb.Append("Security concern text: ");
        sb.AppendLine(details);
        sb.AppendLine("--------------------------------------------------------");
        sb.AppendLine();

        //Write the data to the output file
        WriteDiagnisticTextToFile("securityconcern", sb.ToString());
    }