Пример #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();
        }
Пример #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);
        }