Files
squad-rain-ops-mini/Helpers/RainOpsLog.cs

40 lines
897 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RainOpsMini.Helpers
{
/// <summary>
/// 单体日志输出工具
/// </summary>
public class RainOpsLog
{
/// <summary>
/// 业务锁防止文件被多次占用
/// </summary>
static readonly object objSync = new object();
/// <summary>
/// 输出日志
/// </summary>
/// <param name="content">日志内容</param>
public static void Log(string content)
{
lock (objSync)
{
//日志内容自动换行
content = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff") + "" + content + "\r\n";
Console.Write(content);
}
}
}
}