Movensys.LogHelper.Core 1.5.6

dotnet add package Movensys.LogHelper.Core --version 1.5.6
                    
NuGet\Install-Package Movensys.LogHelper.Core -Version 1.5.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Movensys.LogHelper.Core" Version="1.5.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Movensys.LogHelper.Core" Version="1.5.6" />
                    
Directory.Packages.props
<PackageReference Include="Movensys.LogHelper.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Movensys.LogHelper.Core --version 1.5.6
                    
#r "nuget: Movensys.LogHelper.Core, 1.5.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Movensys.LogHelper.Core@1.5.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Movensys.LogHelper.Core&version=1.5.6
                    
Install as a Cake Addin
#tool nuget:?package=Movensys.LogHelper.Core&version=1.5.6
                    
Install as a Cake Tool

Movensys.LogHelper

This is a function for writing logs in .txt format developed by the Movensys Application Team.

Features

  • Easy to use based on enum
  • Write logs of DEBUG, TRACE, INFORMATION, WARNING, ERROR, FATAL Type
  • Supports auto-compression and auto-delete functions
  • Log history GUI function support
  • Log datagridview GUI feature support
  • Log option setting GUI feature support

Code Highlighting

using Movensys.LogHelper;

namespace WinFormsApp1
{
    //Define Log
    enum MyLogger
    {
        EquipA,
        EquipB,
        EquipC
    }
    enum MachineExample
    {
        Motion,
        Net,
        Com
    }

    internal static class Program
    {
        [STAThread]
        static void Main()
        {
            //Add Init
            LogHelper<MyLogger>.Init(); //Init(true) => Virtual Mode
            LogHelper<MachineExample>.Init(new string[]{"0", "1", "2"});

            //Use Example
            LogHelper<MyLogger>.GetLogger(MyLogger.EquipA).INFOMATION("Process Start!");
            LogHelper<MachineExample>.GetLogger(MachineExample.Motion, "0").INFOMATION("Process Start!");
            LogHelper<MachineExample>.GetLogger(MachineExample.Motion, "1").INFOMATION("Process Start!");
            LogHelper<MachineExample>.GetLogger(MachineExample.Motion, "2").INFOMATION("Process Start!");
            ApplicationConfiguration.Initialize();
            Application.Run(new Form1());
        }
    }
}

Tip

After writing a detailed log, proceed with the operation by activating and deactivating it. You can merge and check the logs written in multiple loggers through History.

Configuration File (LogConfig.json)

Logger options are stored in LogConfig.json next to the executable (1.5.2 and earlier used LogConfig.ini). One section per logger, named {MainDirName}_{LogType} (= Logger.configSection), with the same 12 keys and the same string values as the ini.

{
  "MyLogger_EquipA": {
    "DirType": "0",
    "BasePath": "C:\\MyApp\\Log",
    "CompressOptionEnable": "False",
    "CompressCycleDays": "30",
    "RemoveOptionEnable": "True",
    "RemoveCycleDays": "30",
    "TraceLogEnable": "True",
    "DebugLogEnable": "True",
    "InformationLogEnable": "True",
    "WarningLogEnable": "True",
    "ErrorLogEnable": "True",
    "FatalLogEnable": "True"
  },
  "MachineExample_0_Motion": {
    "DirType": "1",
    "BasePath": "D:\\Log",
    ...
  }
}
  • DirType : 0 = Year\Month\Day\MainDir\LogType, 1 = MainDir\LogType\Year\Month\Day
  • CompressCycleDays / RemoveCycleDays : 1 ~ 365
  • Values are strings like the ini. Numbers and true / false without quotes are also accepted.
  • A missing or invalid key is written back with its default value (same as before).

Load rules

  1. LogConfig.json exists → it is read.
  2. No LogConfig.json but LogConfig.ini exists → the ini is read once and the same content is written to LogConfig.json (automatic conversion). The ini is left as it is and is no longer read or written.
  3. Neither exists → each logger writes its default values to LogConfig.json (same as before).
  • The file is read once per process and shared by all loggers. It is read again only when the file has changed (e.g. edited by hand, then LoadConfig() / Load button in the settings window).
  • To convert the ini again, delete LogConfig.json.
  • If LogConfig.json cannot be parsed (e.g. a typo while editing), it is kept as LogConfig.json.broken and rebuilt from the ini or default values.
  • The file is written through a temporary file and then replaced, so a half-written file is never left.
  • If you go back to 1.5.2 or earlier, the old DLL reads LogConfig.ini again; changes made after the conversion are only in LogConfig.json.

Release History

Nov 22, 2026 - 1.5.6 ver<br> Compress and remove no longer stop log writing. Up to 1.5.5 the one log thread of each LogHelper<T> ran compress → remove → write in turn (at start and every hour), so while the remove pass ran no logger of that T wrote to its file; lines waited in memory and were lost if the process died. Now compress and remove run on their own thread ({T} Log Housekeeping); the write thread ({T} Log Manager) only writes. Only past dates are removed, so it never touches the files being written. Remove now looks only at this logger's own past date folders. Up to 1.5.5, with Year_Month_Date_Type every logger walked the whole base folder (all sub folders, and all files again under each folder), so the time grew with loggers × folders × files; a file was taken as its own when its path contained the logger name (logger CV_A removed the files of CV_AB); and any folder without files was deleted, including other loggers' folders and empty folders outside the log tree. Now year · month · day folders are picked by name (older than the remove date) and only this logger's path is checked, in both folder types (files left by the other folder type are removed too). The remove rule is the same: a file whose last write date is before today − RemoveCycleDays (a zip = the day it was compressed). Empty folders of this month and this year are kept. Measured with 75 loggers on a base folder of 11,520 files (4 days): first write after start, remove on for 1 logger 4.9 s → 0.12 s, for all 75 loggers no write within 300 s → 0.12 ~ 0.67 s. Remove result is the same as 1.5.5 except the three fixed points above.

Nov 12, 2026 - 1.5.5 ver<br> GetLogHistory no longer throws on a broken log line. A line left half-written by a forced stop or power cut, with the next run's record appended to it (ex. [..00:41:59.8210],[SEQ_INFO],[[..00:42:21.7504],[SEQ_INFO],[INFORMATION],[19],[msg => ..]), used to throw "Parsing Error"; a viewer whose loading thread does not catch it (LogHelper.WinForms 1.5.1 and earlier) ended the whole application. Now such a line is split at each record head (time · type · level · index) and each record is read; the leftover fragment is dropped, and a line that cannot be read is skipped. A record whose head was complete but whose message was cut keeps the message up to the cut, and the record appended after it is no longer lost inside that message. A folder or file that cannot be read while loading (deleted or compressed meanwhile, locked, no permission) is skipped instead of throwing. Measured on 562 logger-days of test logs: records returned = record heads in the files (947,485), no exception; 541 logger-days give the same result as 1.5.4, the other 21 are the broken ones. Speed is the same as 1.5.4.

Nov 12, 2026 - 1.5.4 ver<br> GetLogHistory (log history loading) is faster: the line pattern (Regex, Compiled) was built again for every hourly file and line ends were compared culture-sensitively. Now the Regex is built once and the line end is compared ordinally. Measured: 1 logger · 1 day (24 files, 4000 lines) 108 ms → 11 ms, 100 loggers · 1 day (400,000 lines) 11.2 s → 1.6 s, History Viewer load of the same day 12.2 s → 2.9 s. Parsed result is the same.

Nov 11, 2026 - 1.5.3 ver<br> Log option file changed from LogConfig.ini to LogConfig.json (System.Text.Json on net5.0 / net8.0, built-in DataContract JSON on .NET Framework; no new package dependency). An existing LogConfig.ini is converted once automatically. Startup is faster: 1.5.2 re-read the whole ini 12 times per logger and rewrote it once per logger. Now the file is read once per process. Measured Init time: 48 loggers 1.56 s → 0.04 s, 134 loggers 4.76 s → 0.05 s (first run that adds 134 new sections 28.6 s → 1.7 s). Public API, log paths, file names, folder structure and log line format are unchanged.

Nov 6, 2026 - 1.5.2 ver<br> The log file is kept open during a write batch instead of being opened and closed for every line (file filter drivers / antivirus hooking CloseHandle delayed the whole log thread). It is closed when the hourly file changes or after 30 s idle.

Jul 16, 2026 - 1.5.1 ver<br> When the configured log path is missing or not writable (e.g. moving a binary to another PC), the logger now falls back to the default path instead of losing logs, and reports it via the new PathFallbackEvent / EffectiveBasePath / IsPathFallbackActive members.

Oct 29, 2025 - 1.5.0 ver<br> To handle Log as a single enum in an array object, an ID parameter has been added to the Init function. If an ID is assigned, the Log Directory is separated.

Aug 28, 2025 - 1.4.10 ver<br> Supplemental update for exception situations that occur when writing logs in a File Lock situation.

July 2, 2025 - 1.4.9 ver<br> Action to resolve error in loading logs written in the past as "INFOMATION" when loading Log History.

July 2, 2025 - 1.4.8 ver<br> Added Virtual Mode (Added Virtual Mode in which logs are not written for history confirmation) If Program A is using LogHelper.Core, and Program B also initializes LogHelper.Core with the same Enum in Virtual Mode by calling Init(true), then Program B can view the log history of Program A through LogHelper.Winforms. The Virtual Mode feature allows Program B to inspect the logs generated by Program A.

June 27, 2025 - 1.4.7 ver<br> Modify LogLevel Text and function name (INFOMATION → INFORMATION) Add missing RemoveOptionDisable function

May 28, 2025 - 1.4.6 ver<br> Fix save path error

April 30, 2025 - 1.4.5 ver<br> Only the Function function is separated from the existing LogHelper 1.4.3 (for cross-platform) Some changes to Directory path functionality (multilingual support)

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net45 is compatible.  net451 is compatible.  net452 is compatible.  net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETFramework 4.8.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Movensys.LogHelper.Core:

Package Downloads
Movensys.LogHelper.WinForms

Created by Movensys Application Team with .txt logging functionality

Movensys.BlackBox.Core

Created by Movensys Application Team with BlackBox functionality

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.6 0 11/23/2026
1.5.0 317 10/29/2025
1.4.10 336 8/28/2025
1.4.9 294 7/2/2025
1.4.8 327 7/2/2025 1.4.8 is deprecated because it is no longer maintained and has critical bugs.
1.4.7 228 6/27/2025
1.4.6 252 5/28/2025
1.4.5 294 4/30/2025