按照客户要求将excel导出文件保存为一个条码一条记录,名称为SN_结果_时间.xslx

This commit is contained in:
LL
2025-11-14 17:27:29 +08:00
commit 883060d140
79 changed files with 166110 additions and 0 deletions

31
SLZ_4/FileLogger.cs Normal file
View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SLZ_4
{
public enum LogLevel
{
DEBUG,
INFO,
WARNING,
ERROR
}
class FileLogger
{
private static readonly string LogPath = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"logs",
$"{DateTime.Now:yyyyMMdd}.log");
public static void Log(string message, LogLevel level = LogLevel.INFO)
{
Directory.CreateDirectory(Path.GetDirectoryName(LogPath));
File.AppendAllText(LogPath,
$"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] [{level}] {message}{Environment.NewLine}");
}
}
}