5.3 KiB
5.3 KiB
Changelog
[1.0.1] - 2025-03-27
Fixed
- Correct transfer of priority when writing to the system log.
[1.0.0] - 2025-03-23
Added
- Thread-safety: Added a
Mutex
to ensure thread-safe logging operations across all methods (_mutex
inLog
class). - Destructor: Implemented
~this()
to properly close the log file when theLog
instance 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,
Log
class, and all public/private methods, including examples. - Immutable arrays: Made
_sysPriority
,_sysPriorityOS
,_color
(Windows),_colorCodes
(both platforms), and_type
arrays 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
writefile
by logging exception messages instead of the full exception object.
Changed
- Output handling:
- Removed separate
writestdout
andwritestderr
methods; consolidated into a singlewritestd
method that dynamically selectsstdout
orstderr
based on log level (ERROR
and above go tostderr
, others tostdout
). - Adjusted output enum values:
SYSLOG = 1
,STD = 2
,FILE = 8
(removedSTDERR = 4
as it's now handled bySTD
).
- Removed separate
- Windows-specific:
- Renamed
_color
to_colorCodes
for consistency with POSIX. - Updated
writesyslog
to usetoUTF16z()
for_name
and added null checks.
- Renamed
- POSIX-specific:
- Renamed
_color
to_colorCodes
and simplified console output logic inwritestd
. - Changed
writesyslog
to pass priority directly instead of mapping it.
- Renamed
- Log level filtering: Moved priority check (
_priority > priority
) intowritelog
under the mutex for consistency. - File logging:
- Simplified
writefile
by maintaining an openFile
handle (_file
) instead of opening/closing on each write. - Removed redundant file existence check (
this._path.exists
) asFile
opening 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 viaOutput
struct methods.
- Renamed
Removed
- Deprecated method: Removed the deprecated
Log output(int outs)
method; users must now use the fluentOutput
struct. - Redundant output flags: Removed
STDERR
from output enum as it's now handled dynamically bySTD
. - Unnecessary struct fields: Removed
_output
and_newoutput
fromOutput
struct; replaced with a singlevalue
field. - Redundant methods: Removed separate
writestdout
andwritestderr
in favor ofwritestd
.
Fixed
- Windows console output: Added error checking in
colorTextOutput
anddefaultTextOutput
withGetConsoleScreenBufferInfo
. - File closing: Ensured proper file closure in
file
method when changing the log file path.
Breaking Changes
- Output enum changes:
STDOUT
renamed toSTD
,STDERR
removed; code relying onSTDERR = 4
will need adjustment.- Users must update output configuration to use
STD
instead of separateSTDOUT
/STDERR
.
- Method removal: Code using the deprecated
Log output(int outs)
must switch toLog.output(Output)
. - Console output behavior: Messages with priority
ERROR
and above now go tostderr
by default whenSTD
is 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
WARNING
level will not be output to thestdout
. To output them, need to usestderr
- Write message to specific outputs via
log.now
- Now
log.output
allows to set the output as an argument - Now
log.level
allows 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