Enforcement configuration
示例#1
0
 public SdParam(SdParamConfig sdParamConfig, EnforcementConfig enforcementConfig)
 {
     name = sdParamConfig.Name;
     value = sdParamConfig.Value;
     paramNamePolicySet = new ParamNamePolicySet(enforcementConfig);
     paramValuePolicySet = new ParamValuePolicySet(enforcementConfig);
 }
 public ParamValuePolicySet(EnforcementConfig enforcementConfig)
 {
     AddPolicies(new List<IBasicPolicy<string, string>>
     {
         new ReplaceKnownValuePolicy(enforcementConfig, InvalidParamValuePattern, InvalidParamValueReplacement)
     });
 }
 public SdIdPolicySet(EnforcementConfig enforcementConfig)
 {
     AddPolicies(new List<IBasicPolicy<string, string>>
     {
         new TransliteratePolicy(enforcementConfig),
         new ReplaceKnownValuePolicy(enforcementConfig, InvalidSdId, QuestionMark),
         new TruncateToKnownValuePolicy(enforcementConfig,SdIdMaxLength)
     });
 }
 public TagPolicySet(EnforcementConfig enforcementConfig)
 {
     AddPolicies(new IBasicPolicy<string, string>[]
     {
         new TransliteratePolicy(enforcementConfig),
         new ReplaceKnownValuePolicy(enforcementConfig, NonAlphaNumeric, QuestionMark),
         new TruncateToKnownValuePolicy(enforcementConfig, TagMaxLength)
     });
 }
 public PlainContentPolicySet(EnforcementConfig enforcementConfig)
 {
     AddPolicies(new List<IBasicPolicy<string, string>>
     {
         new TransliteratePolicy(enforcementConfig),
         new ReplaceKnownValuePolicy(enforcementConfig, NonSpaceOrPrintUsAscii, QuestionMark),
         new ReplaceKnownValuePolicy(enforcementConfig, NonAlphaNumericFirstChar, PrefixWithSpaceReplacement)
     });
 }
 public PlainHostnamePolicySet(EnforcementConfig enforcementConfig)
 {
     AddPolicies(new IBasicPolicy<string, string>[]
     {
         new TransliteratePolicy(enforcementConfig),
         new DefaultIfEmptyPolicy(Dns.GetHostName()),
         new ReplaceKnownValuePolicy(enforcementConfig, NonPrintUsAscii, QuestionMark)
     });
 }
示例#7
0
        public Rfc3164(Facility facility, Rfc3164Config rfc3164Config, EnforcementConfig enforcementConfig) : base(facility, enforcementConfig)
        {
            hostnamePolicySet = new PlainHostnamePolicySet(enforcementConfig);
            tagPolicySet = new TagPolicySet(enforcementConfig);
            plainContentPolicySet = new PlainContentPolicySet(enforcementConfig);
            asciiMessagePolicy = new AsciiMessagePolicy(enforcementConfig);

            hostnameLayout = rfc3164Config.Hostname;
            tagLayout = rfc3164Config.Tag;
        }
 public AppNamePolicySet(EnforcementConfig enforcementConfig, string defaultAppName)
 {
     AddPolicies(new IBasicPolicy<string, string>[]
     {
         new TransliteratePolicy(enforcementConfig),
         new DefaultIfEmptyPolicy(defaultAppName),
         new ReplaceKnownValuePolicy(enforcementConfig, NonPrintUsAscii, QuestionMark),
         new TruncateToKnownValuePolicy(enforcementConfig, AppNameMaxLength)
     });
 }
 public ParamNamePolicySet(EnforcementConfig enforcementConfig)
 {
     basicPolicies = new List<IBasicPolicy<string, string>>
     {
         new TransliteratePolicy(enforcementConfig),
         new ReplaceKnownValuePolicy(enforcementConfig, NonSafePrintUsAscii, QuestionMark),
         new TruncateToKnownValuePolicy(enforcementConfig, ParamNameMaxLength)
     };
     replaceComputedValuePolicy = new ReplaceComputedValuePolicy(enforcementConfig, QuestionMark);
 }
示例#10
0
 public AsyncLogger(Layout loggingLayout, EnforcementConfig enforcementConfig, MessageBuilder messageBuilder, MessageTransmitterConfig messageTransmitterConfig)
 {
     layout = loggingLayout;
     cts = new CancellationTokenSource();
     token = cts.Token;
     throttling = Throttling.FromConfig(enforcementConfig.Throttling);
     queue = NewBlockingCollection();
     buffer = new ByteArray(enforcementConfig.TruncateMessageTo);
     messageTransmitter = MessageTransmitter.FromConfig(messageTransmitterConfig);
     Task.Factory.StartNew(() => ProcessQueueAsync(messageBuilder));
 }
示例#11
0
 public Rfc5424(Facility facility, Rfc5424Config rfc5424Config, EnforcementConfig enforcementConfig) : base(facility, enforcementConfig)
 {
     version = DefaultVersion;
     hostnameLayout = rfc5424Config.Hostname;
     appNameLayout = rfc5424Config.AppName;
     procIdLayout = NilValue;
     msgIdLayout = NilValue;
     structuredData = new StructuredData(rfc5424Config.StructuredData, enforcementConfig);
     disableBom = rfc5424Config.DisableBom;
     hostnamePolicySet = new FqdnHostnamePolicySet(enforcementConfig, rfc5424Config.DefaultHostname);
     appNamePolicySet = new AppNamePolicySet(enforcementConfig, rfc5424Config.DefaultAppName);
     procIdPolicySet = new ProcIdPolicySet(enforcementConfig);
     msgIdPolicySet = new MsgIdPolicySet(enforcementConfig);
     utf8MessagePolicy = new Utf8MessagePolicy(enforcementConfig);
 }
 public StructuredData(StructuredDataConfig sdConfig, EnforcementConfig enforcementConfig)
 {
     fromEventProperties = sdConfig.FromEventProperties;
     sdElements = sdConfig.SdElements.Select(sdElementConfig => new SdElement(sdElementConfig, enforcementConfig)).ToList();
 }
 public TruncateToComputedValuePolicy(EnforcementConfig enforcementConfig, bool assumeAsciiEncoding)
 {
     messageMaxLength = enforcementConfig.TruncateMessageTo > MaxLengthNotToBeExceeded ? MaxLengthNotToBeExceeded : enforcementConfig.TruncateMessageTo;
     assumeAscii = assumeAsciiEncoding;
 }
示例#14
0
 /// <summary>Builds a new instance of the SyslogTarget class</summary>
 public SyslogTarget()
 {
     Enforcement = new EnforcementConfig();
     MessageCreation = new MessageBuilderConfig();
     MessageSend = new MessageTransmitterConfig();
 }
示例#15
0
 public SdId(SimpleLayout sdIdConfig, EnforcementConfig enforcementConfig)
 {
     layout = sdIdConfig;
     sdIdPolicySet = new SdIdPolicySet(enforcementConfig);
 }
 public ReplaceComputedValuePolicy(EnforcementConfig enforcementConfig, string replaceWith)
 {
     this.enforcementConfig = enforcementConfig;
     this.replaceWith = replaceWith;
 }
 protected MessageBuilder(Facility facility, EnforcementConfig enforcementConfig)
 {
     this.facility = facility;
     splitOnNewLinePolicy = new SplitOnNewLinePolicy(enforcementConfig);
 }
示例#18
0
 public SdElement(SdElementConfig sdElementConfig, EnforcementConfig enforcementConfig)
 {
     sdId = new SdId(sdElementConfig.SdId , enforcementConfig);
     sdParams = sdElementConfig.SdParams.Select(sdParamConfig => new SdParam(sdParamConfig, enforcementConfig)).ToList();
 }
 public AsciiMessagePolicy(EnforcementConfig enforcementConfig)
 {
     truncatePolicy = new TruncateToComputedValuePolicy(enforcementConfig, AssumeAsciiEncoding);
 }
 public static MessageBuilder FromConfig(MessageBuilderConfig messageBuilderConfig, EnforcementConfig enforcementConfig)
 {
     return BuilderFactory[messageBuilderConfig.Rfc](messageBuilderConfig, enforcementConfig);
 }