5.2 KiB
5.2 KiB
Changelog
[1.0.0] - 2025-03-23
Added
- Thread-safety: Added a
Mutexto ensure thread-safe logging operations across all methods (_mutexinLogclass). - Destructor: Implemented
~this()to properly close the log file when theLoginstance is destroyed. - File handle management: Introduced
_file(File handle) and_fileOpen(flag) for better file management, reducing repeated file opening/closing. - Enhanced documentation: Added detailed DDoc comments for the module,
Logclass, and all public/private methods, including examples. - Immutable arrays: Made
_sysPriority,_sysPriorityOS,_color(Windows),_colorCodes(both platforms), and_typearrays immutable for better safety and performance. - Singleton initialization: Improved singleton pattern with double-checked locking in
@property static Log msg()for thread-safe initialization. - Fluent interface naming: Renamed output-related enums (
SYSLOG,STD,FILE) and methods (std,syslog,file) for consistency and clarity (e.g.,STDOUT→STD). - Error handling: Enhanced error reporting in
writefileby logging exception messages instead of the full exception object.
Changed
- Output handling:
- Removed separate
writestdoutandwritestderrmethods; consolidated into a singlewritestdmethod that dynamically selectsstdoutorstderrbased on log level (ERRORand above go tostderr, others tostdout). - Adjusted output enum values:
SYSLOG = 1,STD = 2,FILE = 8(removedSTDERR = 4as it's now handled bySTD).
- Removed separate
- Windows-specific:
- Renamed
_colorto_colorCodesfor consistency with POSIX. - Updated
writesyslogto usetoUTF16z()for_nameand added null checks.
- Renamed
- POSIX-specific:
- Renamed
_colorto_colorCodesand simplified console output logic inwritestd. - Changed
writesyslogto pass priority directly instead of mapping it.
- Renamed
- Log level filtering: Moved priority check (
_priority > priority) intowritelogunder the mutex for consistency. - File logging:
- Simplified
writefileby maintaining an openFilehandle (_file) instead of opening/closing on each write. - Removed redundant file existence check (
this._path.exists) asFileopening handles it implicitly.
- Simplified
- Configuration methods: Made all setters (
program,file,level,color,output) thread-safe withsynchronized (_mutex). - Naming consistency:
- Renamed
Output.output()to internal use; public access is viaOutputstruct methods.
- Renamed
Removed
- Deprecated method: Removed the deprecated
Log output(int outs)method; users must now use the fluentOutputstruct. - Redundant output flags: Removed
STDERRfrom output enum as it's now handled dynamically bySTD. - Unnecessary struct fields: Removed
_outputand_newoutputfromOutputstruct; replaced with a singlevaluefield. - Redundant methods: Removed separate
writestdoutandwritestderrin favor ofwritestd.
Fixed
- Windows console output: Added error checking in
colorTextOutputanddefaultTextOutputwithGetConsoleScreenBufferInfo. - File closing: Ensured proper file closure in
filemethod when changing the log file path.
Breaking Changes
- Output enum changes:
STDOUTrenamed toSTD,STDERRremoved; code relying onSTDERR = 4will need adjustment.- Users must update output configuration to use
STDinstead of separateSTDOUT/STDERR.
- Method removal: Code using the deprecated
Log output(int outs)must switch toLog.output(Output). - Console output behavior: Messages with priority
ERRORand above now go tostderrby default whenSTDis enabled, which may change existing output redirection logic.
[0.5.0] - 2023-07-21
New
- Added the ability to output messages to the standard error stream. Now messages above the
WARNINGlevel will not be output to thestdout. To output them, need to usestderr - Write message to specific outputs via
log.now - Now
log.outputallows to set the output as an argument - Now
log.levelallows to set the level as an argument
Bug fixes
- Fixed streams redirection in Windows
[0.4.0] - 2023-06-07
- Part of the code has been changed/rewritten
New
- Color output of messages to the terminal and console
Bug fixes
- In Windows, unicode messages are output without distortion to the system log and console (thanks Adam D. Ruppe)
[0.3.2] - 2023-06-01
- Printing information about the type of the logged message to the standard output stream and file
- Printing the date and time to the standard output stream
[0.3.1] - 2023-05-30
Bug fixes
- Log of debug messages
[0.3.0] - 2023-04-28
- Minor changes
New
- Windows OS Logging support
[0.2.1] - 2023-03-29
New
- Added aliases for the short form of function calls
Bug fixes
- Calling the main object
[0.2.0] - 2023-03-29
- Removed functions
fileOn()andfileOff()
New
- Simultaneous writing to the standard stream, syslog and file by binary setting the output flag
[0.1.0] - 2023-03-23
The first stable working release
- Output to the standard stream or syslog
- Enable an entry in the file