Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit b98e446

Browse files
committed
Fixed color encodings being in the file log
1 parent 91be5bb commit b98e446

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/EasyLog/EasyLog.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>enable</Nullable>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
88
<PackageId>Easy-Log</PackageId>
9-
<Version>2.0.0</Version>
9+
<Version>2.0.2</Version>
1010
<Title>Easy-Log</Title>
1111
<Authors>Fyrax</Authors>
1212
<Description>Simple and easy Logging System for C# .NET with colors and format support</Description>
@@ -16,7 +16,7 @@
1616
<RepositoryUrl>https://github.com/byte-0x74/EasyLog</RepositoryUrl>
1717
<PackageTags>log logger logging logsystem easylog</PackageTags>
1818
<PackageIcon>easylog.png</PackageIcon>
19-
<PackageReleaseNotes>Whole project rewrite see sample project for example how to use</PackageReleaseNotes>
19+
<PackageReleaseNotes>Fixed color encodings being in the file log</PackageReleaseNotes>
2020
</PropertyGroup>
2121

2222
<ItemGroup>

src/EasyLog/Logger.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ public Logger(LoggerOptions loggerOptions)
3232
{
3333
var logType = GetLogType<T>();
3434
var sb = new StringBuilder();
35+
var dateTime = DateTime.Now.ToLongTimeString();
3536
if (_loggerOptions.ShowDateAndTime)
3637
{
37-
sb.Append($"[{DateTime.Now.ToLongTimeString()}] ");
38+
sb.Append($"[{dateTime}] ");
3839
}
3940
sb.Append($"{logType.Prefix}: ".Pastel(logType.PrefixColor));
4041
sb.Append(Utils.Format(str, args));
@@ -45,7 +46,7 @@ public Logger(LoggerOptions loggerOptions)
4546
Console.Write(colorized);
4647
}
4748

48-
_fileStream?.Write(sb.ToString());
49+
_fileStream?.Write($"[{dateTime}] {logType.Prefix}: {Utils.Format(str, args)}");
4950
}
5051

5152
public void LogException(Exception ex)

0 commit comments

Comments
 (0)