示例#1
0
 public virtual void UpdateLogType(LogTypeInfo logType)
 {
     LoggingProvider.Instance().UpdateLogType(logType.LogTypeKey, logType.LogTypeFriendlyName, logType.LogTypeDescription, logType.LogTypeCSSClass, logType.LogTypeOwner);
 }
示例#2
0
 public virtual object GetSingleLog(LogInfo log, LoggingProvider.ReturnType returnType)
 {
     return(LoggingProvider.Instance().GetSingleLog(log, returnType));
 }
示例#3
0
 public void PurgeLogBuffer()
 {
     LoggingProvider.Instance().PurgeLogBuffer();
 }
示例#4
0
 public virtual LogTypeConfigInfo GetLogTypeConfigInfoByID(string id)
 {
     return(LoggingProvider.Instance().GetLogTypeConfigInfoByID(id));
 }
示例#5
0
 public virtual Dictionary <string, LogTypeInfo> GetLogTypeInfoDictionary()
 {
     return(LoggingProvider.Instance().GetLogTypeInfo().Cast <LogTypeInfo>().ToDictionary(logTypeInfo => logTypeInfo.LogTypeKey));
 }
示例#6
0
 public virtual List <LogInfo> GetLogs(int portalID, string logType, int pageSize, int pageIndex, ref int totalRecords)
 {
     return(LoggingProvider.Instance().GetLogs(portalID, logType, pageSize, pageIndex, ref totalRecords));
 }
示例#7
0
 public virtual ArrayList GetLogTypeConfigInfo()
 {
     return(LoggingProvider.Instance().GetLogTypeConfigInfo());
 }
示例#8
0
 public virtual void DeleteLogTypeConfigInfo(LogTypeConfigInfo logTypeConfig)
 {
     LoggingProvider.Instance().DeleteLogTypeConfigInfo(logTypeConfig.ID);
 }
示例#9
0
 public virtual void DeleteLogType(LogTypeInfo logType)
 {
     LoggingProvider.Instance().DeleteLogType(logType.LogTypeKey);
 }
示例#10
0
 public void DeleteLog(LogInfo logInfo)
 {
     LoggingProvider.Instance().DeleteLog(logInfo);
 }
示例#11
0
 public void ClearLog()
 {
     LoggingProvider.Instance().ClearLog();
 }
示例#12
0
        public void AddLog(LogInfo logInfo)
        {
            //if (Globals.Status == Globals.UpgradeStatus.Install)
            //{
            //    Logger.Info(logInfo);
            //}
            //else
            //{
            try
            {
                logInfo.LogCreateDate = DateTime.Now;
                logInfo.LogServerName = Globals.ServerName;
                if (string.IsNullOrEmpty(logInfo.LogServerName))
                {
                    logInfo.LogServerName = "NA";
                }
                if (String.IsNullOrEmpty(logInfo.LogUserName))
                {
                    logInfo.LogUserName = "";

                    //if (HttpContext.Current != null)
                    //{
                    //    if (HttpContext.Current.Request.IsAuthenticated)
                    //    {
                    //        logInfo.LogUserName = UserController.Instance.GetCurrentUserInfo().Username;
                    //    }
                    //}
                }

                //Get portal name if name isn't set
                if (logInfo.LogPortalID != Null.NullInteger && String.IsNullOrEmpty(logInfo.LogPortalName))
                {
                    //logInfo.LogPortalName = PortalController.Instance.GetPortal(logInfo.LogPortalID).PortalName;
                    logInfo.LogPortalName = "";
                }

                //Check if Log Type exists
                if (!GetLogTypeInfoDictionary().ContainsKey(logInfo.LogTypeKey))
                {
                    //Add new Log Type
                    var logType = new LogTypeInfo()
                    {
                        LogTypeKey          = logInfo.LogTypeKey,
                        LogTypeFriendlyName = logInfo.LogTypeKey,
                        LogTypeOwner        = "DotNetNuke.Logging.EventLogType",
                        LogTypeCSSClass     = "GeneralAdminOperation",
                        LogTypeDescription  = string.Empty
                    };
                    AddLogType(logType);

                    var logTypeConfigInfo = new LogTypeConfigInfo()
                    {
                        LogTypeKey                    = logInfo.LogTypeKey,
                        LogTypePortalID               = "*",
                        LoggingIsActive               = false,
                        KeepMostRecent                = "-1",
                        EmailNotificationIsActive     = false,
                        NotificationThreshold         = 1,
                        NotificationThresholdTime     = 1,
                        NotificationThresholdTimeType = LogTypeConfigInfo.NotificationThresholdTimeTypes.Seconds,
                        MailFromAddress               = String.Empty,
                        MailToAddress                 = String.Empty
                    };
                    AddLogTypeConfigInfo(logTypeConfigInfo);
                }

                if (LoggingProvider.Instance() != null)
                {
                    try
                    {
                        LoggingProvider.Instance().AddLog(logInfo);
                    }
                    catch (Exception)
                    {
                        if (Globals.Status != Globals.UpgradeStatus.Upgrade)     //this may caught exception during upgrade because old logging provider has problem in it.
                        {
                            throw;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Logger.Error(exc);

                AddLogToFile(logInfo);
            }
            //}
        }