public static void Log(this IDxStoreEventLogger logger, string periodicKey, TimeSpan?periodicDuration, DxEventSeverity severity, int id, string formatString, params object[] args)
 {
     if (periodicKey != null)
     {
         logger.LogPeriodic(periodicKey, periodicDuration.Value, severity, id, formatString, args);
         return;
     }
     logger.Log(severity, id, formatString, args);
 }
Example #2
0
        public static void LogInfo(string formatString, params object[] args)
        {
            IDxStoreEventLogger instance = EventLogger.Instance;

            if (instance != null)
            {
                instance.Log(DxEventSeverity.Info, 0, formatString, args);
            }
        }
Example #3
0
 public static void LogFinishedEvent(string identity, string label, IDxStoreEventLogger logger, bool isPeriodic, string periodicKey, TimeSpan?periodicDuration, string context)
 {
     if (logger != null)
     {
         logger.Log((isPeriodic && periodicDuration != null) ? (periodicKey + "Finished") : null, periodicDuration, DxEventSeverity.Info, 0, "{0}: Operation {1} ({2}) successfuly completed", new object[]
         {
             identity,
             label,
             context ?? string.Empty
         });
     }
 }
Example #4
0
 public static void LogStartingEvent(string identity, string label, IDxStoreEventLogger logger, bool isPeriodic, string periodicKey, TimeSpan?periodicDuration, string context)
 {
     if (logger != null)
     {
         logger.Log((isPeriodic && periodicDuration != null) ? (periodicKey + "Starting") : null, periodicDuration, DxEventSeverity.Info, 0, "{0}: Starting operation {1} ({2})", new object[]
         {
             identity,
             label,
             context ?? string.Empty
         });
     }
 }
        private DxStoreStateMachine CreateStateMachine(Round <string>?leaderHint, PaxosBasicInfo referencePaxos)
        {
            Policy policy = new Policy
            {
                DebugName = this.GroupConfig.Self
            };
            bool flag = false;

            string[] array = (from m in this.GroupConfig.Members
                              select m.Name).ToArray <string>();
            if (referencePaxos != null && referencePaxos.IsMember(this.GroupConfig.Self))
            {
                array = referencePaxos.Members;
                flag  = true;
            }
            IDxStoreEventLogger eventLogger = this.EventLogger;
            DxEventSeverity     severity    = DxEventSeverity.Info;
            int    id           = 0;
            string formatString = "{0}: Creating state machine with membership '{1}' (IsUsingReferencePaxos: {2}, IsReferencePaxosLeader: {3}, GroupConfig.Members: {4}";

            object[] array2 = new object[5];
            array2[0] = this.GroupConfig.Identity;
            array2[1] = array.JoinWithComma("<null>");
            array2[2] = flag;
            array2[3] = (flag ? referencePaxos.IsLeader.ToString() : "<unknown>");
            array2[4] = (from m in this.GroupConfig.Members
                         select m.Name).JoinWithComma("<null>");
            eventLogger.Log(severity, id, formatString, array2);
            Dictionary <string, ServiceEndpoint> membersInstanceClientEndPoints = this.GetMembersInstanceClientEndPoints(array);
            NodeEndPointsBase <ServiceEndpoint>  nodeEndPointsBase = new NodeEndPointsBase <ServiceEndpoint>(this.GroupConfig.Self, membersInstanceClientEndPoints);

            this.PerfCounters = new Counters(this.GroupConfig.Identity);
            Configuration <string> configuration = new Configuration <string>(nodeEndPointsBase.Nodes, nodeEndPointsBase.Nodes, nodeEndPointsBase.Nodes, null);
            GroupMembersMesh       mesh          = new GroupMembersMesh(this.Identity, nodeEndPointsBase, this.GroupConfig);
            EsentStorage <string, DxStoreCommand> esentStorage = new EsentStorage <string, DxStoreCommand>(this.GroupConfig.Settings.PaxosStorageDir, this.PerfCounters, null, null, true);

            esentStorage.TryInitialize(configuration);
            return(new DxStoreStateMachine(policy, this, nodeEndPointsBase, esentStorage, mesh, this.PerfCounters, leaderHint));
        }
Example #6
0
 public static void LogErrorEvent(string identity, string label, Exception exception, LogOptions logOptions, IDxStoreEventLogger logger, bool isPeriodic, string periodicKey, TimeSpan?periodicDuration, string context)
 {
     if (logger != null)
     {
         string name    = exception.GetType().Name;
         string message = exception.Message;
         string text    = string.Empty;
         if ((logOptions & LogOptions.LogExceptionFull) == LogOptions.LogExceptionFull)
         {
             text = exception.ToString();
         }
         logger.Log((isPeriodic && periodicDuration != null) ? (periodicKey + "Exception") : null, periodicDuration, DxEventSeverity.Error, 0, "{0}: Operation {1} ({2}) failed. (Category: {3}, Message: {4}, Full: {5})", new object[]
         {
             identity,
             label,
             context ?? string.Empty,
             name,
             message,
             text
         });
     }
 }