Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var fd = GetLogDetails("starting application", null);

            Hlogger.WriteDiagonistic(fd);

            var tracker = new PerfTracker("CrxConsole_Execution", "", fd.UserName, fd.Location, fd.Product, fd.Layer);

            try
            {
                var ex = new Exception("Something bad has happend!");
                ex.Data.Add("input param", "nothing to see here");
                throw ex;
            }
            catch (Exception ex)
            {
                fd = GetLogDetails("", ex);
                Hlogger.WriteError(fd);
            }
            fd = GetLogDetails("Used Hylogger Console", null);
            Hlogger.WriteUsage(fd);

            fd = GetLogDetails("stopping app", null);
            Hlogger.WriteDiagonistic(fd);

            tracker.Stop();
        }
Exemplo n.º 2
0
        public static void LogWebUsage(string product, string layer, string activityName,
                                       Dictionary <string, object> additionalInfo = null)
        {
            string userId, userName, location;
            var    webInfo = GetWebFloggingData(out userId, out userName, out location);

            if (additionalInfo != null)
            {
                foreach (var key in additionalInfo.Keys)
                {
                    webInfo.Add($"Info-{key}", additionalInfo[key]);
                }
            }

            var usageInfo = new HylogDetails()
            {
                Product        = product,
                Layer          = layer,
                TimeStamp      = DateTime.Now,
                Location       = location,
                UserId         = userId,
                UserName       = userName,
                HostName       = Environment.MachineName,
                CorrelationId  = HttpContext.Current.Session.SessionID,
                Message        = activityName,
                AdditionalInfo = webInfo
            };

            Hlogger.WriteUsage(usageInfo);
        }
Exemplo n.º 3
0
        public static void LogWebError(string product, string layer, Exception ex)
        {
            string userId, userName, location;
            var    webInfo = GetWebFloggingData(out userId, out userName, out location);

            var errorInformation = new HylogDetails()
            {
                Product        = product,
                Layer          = layer,
                Location       = location,
                TimeStamp      = DateTime.Now,
                UserId         = userId,
                UserName       = userName,
                HostName       = Environment.MachineName,
                CorrelationId  = HttpContext.Current.Session?.SessionID,
                Exception      = ex,
                AdditionalInfo = webInfo
            };

            Hlogger.WriteError(errorInformation);
        }
Exemplo n.º 4
0
        public static void LogWebDiagnostic(string product, string layer, string message,
                                            Dictionary <string, object> diagnosticInfo = null)
        {
            var writeDiagnostics = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableDiagnostics"]);

            if (!writeDiagnostics)  // doing this to avoid going through all the data - user, session, etc.
            {
                return;
            }

            string userId, userName, location;
            var    webInfo = GetWebFloggingData(out userId, out userName, out location);

            if (diagnosticInfo != null)
            {
                foreach (var key in diagnosticInfo.Keys)
                {
                    webInfo.Add(key, diagnosticInfo[key]);
                }
            }

            var diagInfo = new HylogDetails()
            {
                Product        = product,
                Layer          = layer,
                Location       = location,
                TimeStamp      = DateTime.Now,
                UserId         = userId,
                UserName       = userName,
                HostName       = Environment.MachineName,
                CorrelationId  = HttpContext.Current.Session.SessionID,
                Message        = message,
                AdditionalInfo = webInfo
            };

            Hlogger.WriteDiagonistic(diagInfo);
        }