Esempio n. 1
0
        public void LogCertificate(EdgeSyncLoggingLevel level, EdgeSyncEvent logEvent, X509Certificate2 cert)
        {
            if (cert == null)
            {
                return;
            }
            if (!this.CanLogEvent(level))
            {
                return;
            }
            this.LogEvent(level, logEvent, cert.Subject, "Certificate subject");
            this.LogEvent(level, logEvent, cert.IssuerName.Name, "Certificate issuer name");
            this.LogEvent(level, logEvent, cert.SerialNumber, "Certificate serial number");
            this.LogEvent(level, logEvent, cert.Thumbprint, "Certificate thumbprint");
            StringBuilder stringBuilder = new StringBuilder(256);

            foreach (string value in TlsCertificateInfo.GetFQDNs(cert))
            {
                if (stringBuilder.Length != 0)
                {
                    stringBuilder.Append(';');
                }
                stringBuilder.Append(value);
            }
            this.LogEvent(level, logEvent, stringBuilder.ToString(), "Certificate alternate names");
        }
Esempio n. 2
0
 public void LogEvent(EdgeSyncLoggingLevel loggingLevel, EdgeSyncEvent eventId, string data, string context)
 {
     if (!this.CanLogEvent(loggingLevel))
     {
         return;
     }
     this.row[6] = eventId;
     this.row[9] = context;
     this.row[8] = data;
     this.row[7] = loggingLevel;
     this.edgeSyncLog.Append(this.row);
     this.row[2] = (int)this.row[2] + 1;
 }
Esempio n. 3
0
        public void LogException(EdgeSyncLoggingLevel level, EdgeSyncEvent edgeEvent, Exception exception, string context)
        {
            if (!this.CanLogEvent(level))
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder(exception.Message.Length + exception.GetType().Name.Length + 3);

            stringBuilder.AppendFormat("{0} [{1}]", exception.Message, exception.GetType().Name);
            if (exception.InnerException != null)
            {
                stringBuilder.AppendFormat("; Inner Exception: {0} [{1}]", exception.InnerException.Message, exception.InnerException.GetType().Name);
            }
            this.LogEvent(level, edgeEvent, stringBuilder.ToString(), context);
        }