Ejemplo n.º 1
0
    private static string EnsureLatestPackageReferencesVersion(
        ILogger logger,
        string fileContent,
        LogCategoryType logCategoryType)
    {
        var packageReferencesThatNeedsToBeUpdated = GetPackageReferencesThatNeedsToBeUpdated(logger, fileContent);

        foreach (var item in packageReferencesThatNeedsToBeUpdated)
        {
            fileContent = fileContent.Replace(
                $"<PackageReference Include=\"{item.PackageId}\" Version=\"{item.Version}\"",
                $"<PackageReference Include=\"{item.PackageId}\" Version=\"{item.NewestVersion}\"",
                StringComparison.Ordinal);

            var logMessage = $"{AppEmojisConstants.PackageReference}   PackageReference {item.PackageId} @ {item.Version} => {item.NewestVersion}";
            switch (logCategoryType)
            {
            case LogCategoryType.Debug:
                logger.LogDebug(logMessage);
                break;

            case LogCategoryType.Trace:
                logger.LogTrace(logMessage);
                break;

            default:
                throw new SwitchCaseDefaultException(logCategoryType);
            }
        }

        return(fileContent);
    }
Ejemplo n.º 2
0
 public LogItem(int logID, DateTime date, string message, string exception, LogCategoryType category, string name, string userName)
 {
     _logID     = logID;
     _date      = date;
     _message   = message;
     _exception = exception;
     _category  = category;
     _name      = name;
     _userName  = userName;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// CategoryType转为字符串
        /// </summary>
        /// <param name="operationCategoryType"></param>
        /// <returns></returns>
        public static string ToCategoryString(LogCategoryType operationCategoryType)
        {
            string strCat = string.Empty;

            switch (operationCategoryType)
            {
            case LogCategoryType.EditData:
                strCat = "数据编辑";
                break;

            case LogCategoryType.OtherOperation:
                strCat = "其他操作";
                break;

            case LogCategoryType.Login:
                strCat = "用户登录";
                break;

            case LogCategoryType.Error:
                strCat = "错误";
                break;
            }
            return(strCat);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Syncless.Logging.LogData" /> class, given the time stamp, the log event type and the message.
 /// </summary>
 /// <param name="timestamp">A <see cref="string" /> specifying the time stamp.</param>
 /// <param name="logEvent">A <see cref="System.IO.DirectoryInfo" /> class specifying the log event type.</param>
 /// <param name="message">A <see cref="string" /> specifying the message.</param>
 public LogData(string timestamp, LogEventType logEvent, string message)
 {
     this.timestamp = timestamp;
     this.logEvent = logEvent;
     this.message = message;
     this.logCategory = MapEventToCategory(logEvent);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Syncless.Logging.LogData" /> class, given the log event type and the message.
 /// </summary>
 /// <param name="logEvent">A <see cref="System.IO.DirectoryInfo" /> class specifying the log event type.</param>
 /// <param name="message">A <see cref="string" /> specifying the message.</param>
 public LogData(LogEventType logEvent, string message)
 {
     this.logEvent = logEvent;
     this.message = message;
     this.logCategory = MapEventToCategory(logEvent);
 }
Ejemplo n.º 6
0
 public static LogKeyValueItem Create(
     LogCategoryType logCategoryType,
     string ruleName,
     string description)
 => LogItemFactory.Create(logCategoryType, ruleName, ExtractAreaFromRuleName(ruleName), description);
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogKeyValueItem"/> class.
 /// </summary>
 /// <param name="logCategory">The log category.</param>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <param name="description">The description.</param>
 public LogKeyValueItem(LogCategoryType logCategory, string key, string value, string description)
     : this(logCategory, key, value)
 {
     this.Description = description;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogKeyValueItem"/> class.
 /// </summary>
 /// <param name="logCategory">The log category.</param>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 public LogKeyValueItem(LogCategoryType logCategory, string key, string value)
     : base(key, value)
 {
     this.LogCategory = logCategory;
 }
Ejemplo n.º 9
0
 public static LogKeyValueItem Create(LogCategoryType logCategoryType, string ruleName, string description)
 {
     return(new LogKeyValueItem(logCategoryType, ruleName, ExtractAreaFromRuleName(ruleName), description));
 }