Skip to main content

LogTimestamp

Represents a timestamp for a log entry. The timestamp is a Unix epoch time with nanosecond precision. The timestamp is generated when the LogTimestamp object is created. The timestamp is immutable. The timestamp is represented as a string in the format YYYY-MM-DDTHH:MM:SS.NNNNNNNNNZ.

Index

Constructors

Properties

Methods

Constructors

publicconstructor

  • Creates a new timestamp for a log entry.


    Returns LogTimestamp

Properties

publicreadonlynanos

nanos: number

The number of nanoseconds since the Unix epoch.

publicreadonlyseconds

seconds: number

The number of seconds since the Unix epoch.

Methods

publictoJSON

  • toJSON(): { nanos: number; seconds: number }
  • Returns a JSON representation of the timestamp.


    Returns { nanos: number; seconds: number }

    • nanos: number
    • seconds: number

publictoString

  • toString(): string
  • Returns a string representation of the timestamp in RFC3339 UTC "Zulu" format.

    Example:

    const timestamp = new LogTimestamp();
    console.log(timestamp.toString());
    // Output: 2021-07-29T23:27:47.000000000Z

    Returns string