示例#1
0
        public void Pass()
        {
            if (Writer == null || _PassStream == OutcomeLogStream.None)
            {
                return;
            }

            if (_PassStream == OutcomeLogStream.Warning && Writer.ShouldWriteWarning())
            {
                Writer.WriteWarning(string.Format(PSRuleResources.OutcomeRulePass, RuleRecord.RuleName, Pipeline.Binder.TargetName));
            }

            if (_PassStream == OutcomeLogStream.Error && Writer.ShouldWriteError())
            {
                Writer.WriteError(new ErrorRecord(new RuleRuntimeException(string.Format(PSRuleResources.OutcomeRulePass, RuleRecord.RuleName, Pipeline.Binder.TargetName)), SOURCE_OUTCOME_PASS, ErrorCategory.InvalidData, null));
            }

            if (_PassStream == OutcomeLogStream.Information && Writer.ShouldWriteInformation())
            {
                Writer.WriteInformation(new InformationRecord(messageData: string.Format(PSRuleResources.OutcomeRulePass, RuleRecord.RuleName, Pipeline.Binder.TargetName), source: SOURCE_OUTCOME_PASS));
            }
        }
示例#2
0
 public virtual bool ShouldWriteError()
 {
     return(_Writer != null && _Writer.ShouldWriteError());
 }