using Hotline.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotline.Tools
{
	public class LogTool
	{
		/// <summary>
		/// 截取指定长度的字符串
		/// </summary>
		/// <param name="value"></param>
		/// <param name="length"></param>
		/// <param name="ellipsis"></param>
		/// <returns></returns>
		public static string GetSubString(string value, int length, bool ellipsis = false)
		{
			if (string.IsNullOrEmpty(value))
			{
				return value;
			}
			if (value.Length > length)
			{
				value = value.Substring(0, length);
				if (ellipsis)
				{
					value += "...";
				}
			}
			return value;
		}
	}
}
