public void When_Full_Redaction_Redact_Everything()
 {
     LogManager.RedactionLevel = RedactionLevel.Full;
     Assert.AreEqual("<ud>user</ud>", RedactableArgument.User("user").ToString());
     Assert.AreEqual("<md>meta</md>", RedactableArgument.Meta("meta").ToString());
     Assert.AreEqual("<sd>system</sd>", RedactableArgument.System("system").ToString());
 }
 public void When_Redaction_Disabled_No_Redaction_Occurs()
 {
     LogManager.RedactionLevel = RedactionLevel.None;
     Assert.AreEqual("1", RedactableArgument.User("1").ToString());
     Assert.AreEqual(null, RedactableArgument.Meta(null).ToString());
     Assert.AreEqual("system", RedactableArgument.System("system").ToString());
 }
 public void When_User_Redaction_Redact_Partial()
 {
     LogManager.RedactionLevel = RedactionLevel.Partial;
     Assert.AreEqual("<ud>user</ud>", RedactableArgument.User("user").ToString());
     Assert.AreEqual("meta", RedactableArgument.Meta("meta").ToString());
     Assert.AreEqual("system", RedactableArgument.System("system").ToString());
 }
Esempio n. 4
0
        static void LogConfigurationAndVersion(ClientConfiguration configuration)
        {
            var version = CurrentAssembly.Version;

            Log.Info("Version: {0}", version);

            try
            {
                var config = JsonConvert.SerializeObject(configuration, new JsonSerializerSettings
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                });
                Log.Info("Configuration: {0}", RedactableArgument.User(config));
            }
            catch (Exception e)
            {
                //NCBC-797
                Log.Info("Could not serialize ClientConfiguration.", e);
            }
        }