Skip to main content
Dates is a minimal static utility class in chromologger.utils.dates. It provides a single method, now_date(), which returns the current timestamp used in every log entry written by Logger.

Import

Dates is an internal utility. The Logger class handles timestamp formatting automatically — you do not need to call Dates.now_date() directly in normal usage.

Methods

now_date()

Returns datetime.now() — the current local date and time with microsecond precision. Called internally by Logger.__write() to stamp each log entry at the exact moment it is written. The same method is also used by Logger.__log() when recording entries to the module’s internal error log.
datetime
A datetime object representing the current local time, including microseconds. Equivalent to calling datetime.datetime.now() from the standard library directly.
Example
The datetime object is embedded in log entries using Python’s default str(datetime) representation:
Which produces timestamps like:
These timestamps appear in both log entry formats produced by Logger:
Because now_date() uses datetime.now() (local time, no timezone info), log timestamps reflect the system clock of the machine running your application. If you need timezone-aware timestamps, consider post-processing the log file or subclassing Logger to override __write().