Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LcdLogger
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antoni Zaprzała
LcdLogger
Commits
63d6d367
Commit
63d6d367
authored
Jul 01, 2026
by
AntekZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compression removed, rotate files at 2MB instead of 20MB
parent
42775126
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
LogFileManager.cs
LcdLogger/Services/LogFileManager.cs
+25
-25
appsettings.json
LcdLogger/appsettings.json
+1
-1
No files found.
LcdLogger/Services/LogFileManager.cs
View file @
63d6d367
...
@@ -73,7 +73,7 @@ namespace LcdLogger.Services
...
@@ -73,7 +73,7 @@ namespace LcdLogger.Services
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
}
}
var
files
=
DirectoryInfo
.
GetFiles
(
"lcd-*.log
*
"
).
OrderBy
(
f
=>
f
.
Name
).
ToList
();
var
files
=
DirectoryInfo
.
GetFiles
(
"lcd-*.log"
).
OrderBy
(
f
=>
f
.
Name
).
ToList
();
long
totalBytes
=
files
.
Sum
(
f
=>
f
.
Length
);
long
totalBytes
=
files
.
Sum
(
f
=>
f
.
Length
);
...
@@ -108,35 +108,35 @@ namespace LcdLogger.Services
...
@@ -108,35 +108,35 @@ namespace LcdLogger.Services
var
justClosedFile
=
_currentPath
;
var
justClosedFile
=
_currentPath
;
_
=
Task
.
Run
(
async
()
=>
//
_ = Task.Run(async () =>
{
//
{
await
CompressAsync
(
justClosedFile
);
//
await CompressAsync(justClosedFile);
});
//
});
await
PruneSurplusFilesAsync
(
cancellationToken
);
await
PruneSurplusFilesAsync
(
cancellationToken
);
await
OpenNewAsync
(
cancellationToken
);
await
OpenNewAsync
(
cancellationToken
);
}
}
private
async
Task
CompressAsync
(
string
path
)
//
private async Task CompressAsync(string path)
{
//
{
try
//
try
{
//
{
var
gzPath
=
path
+
".gz"
;
//
var gzPath = path + ".gz";
using
(
var
source
=
File
.
OpenRead
(
path
))
//
using (var source = File.OpenRead(path))
using
(
var
destination
=
File
.
Create
(
gzPath
))
//
using (var destination = File.Create(gzPath))
using
(
var
gzip
=
new
GZipStream
(
destination
,
CompressionLevel
.
SmallestSize
))
//
using (var gzip = new GZipStream(destination, CompressionLevel.SmallestSize))
{
//
{
await
source
.
CopyToAsync
(
gzip
);
//
await source.CopyToAsync(gzip);
}
//
}
File
.
Delete
(
path
);
//
File.Delete(path);
}
//
}
catch
(
Exception
e
)
//
catch (Exception e)
{
//
{
_logger
.
LogError
(
e
.
Message
,
"Compress failed"
);
//
_logger.LogError(e.Message, "Compress failed");
}
//
}
}
//
}
public
async
ValueTask
DisposeAsync
()
public
async
ValueTask
DisposeAsync
()
{
{
...
...
LcdLogger/appsettings.json
View file @
63d6d367
{
{
"Log"
:
{
"Log"
:
{
"Directory"
:
"/var/log/lcd-logger"
,
"Directory"
:
"/var/log/lcd-logger"
,
"RotateAtBytes"
:
2097152
0
,
"RotateAtBytes"
:
2097152
,
"MaxTotalBytes"
:
104857600
,
"MaxTotalBytes"
:
104857600
,
"MinLevel"
:
2
,
"MinLevel"
:
2
,
"MaxBatchEntries"
:
100
,
"MaxBatchEntries"
:
100
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment