### new(level, message, timestamp, metadata \\ [], node \\ node()) Source: https://hexdocs.pm/live_dashboard_logger/LiveDashboardLogger.Log.html Creates a new LiveDashboardLogger.Log struct with the given level, message, timestamp, metadata, and node. The metadata and node arguments have default values of an empty list and the current node, respectively. ```APIDOC ## new(level, message, timestamp, metadata \\ [], node \\ node()) ### Description Creates a new `LiveDashboardLogger.Log` struct with the given level, message, timestamp, metadata, and node. The metadata and node arguments have default values of an empty list and the current node, respectively. ### Function Signature `new(level, message, timestamp, metadata \\ [], node \\ node())` ### Parameters - **level** (`Logger.level()`) - Required - The log level (e.g., `:info`, `:error`). - **message** (`String.t()`) - Required - The log message. - **timestamp** (`timestamp()`) - Required - The timestamp of the log entry, formatted as a tuple of date and time. - **metadata** (`Keyword.t()`) - Optional - Additional metadata as a keyword list. Defaults to `[]`. - **node** (`node()`) - Optional - The node where the log originated. Defaults to `node()`. ### Returns - A `LiveDashboardLogger.Log` struct with the following fields: - `id` (`term()`) - A unique identifier for the log entry. - `level` (`Logger.level()`) - The log level. - `message` (`String.t()`) - The log message. - `metadata` (`Keyword.t()`) - The metadata keyword list. - `node` (`node()`) - The node. - `timestamp` (`timestamp()`) - The timestamp. ### Example ```elixir Log.new(:info, "Hello world", {{2023, 1, 1}, {12, 0, 0, 0}}, [user_id: 123]) ``` ``` -------------------------------- ### Add :live_dashboard_logger dependency in mix.exs Source: https://hexdocs.pm/live_dashboard_logger/readme.html Add the :live_dashboard_logger package to your mix.exs dependencies. Use the version constraint "~> 0.0.1". ```elixir # mix.exs def deps do [ {:live_dashboard_logger, "~> 0.0.1"} ] end ``` -------------------------------- ### Configure live_dashboard with additional_pages and on_mount in router Source: https://hexdocs.pm/live_dashboard_logger/readme.html Add the LiveDashboardLogger page to your Phoenix Live Dashboard configuration in your router. This enables the "Live Logs" page and mounts the LiveDashboardLogger.Hooks. ```elixir # lib/your_app_web/router.ex live_dashboard "/dashboard", metrics: YourAppWeb.Telemetry, additional_pages: [ live_logs: LiveDashboardLogger ], on_mount: [ LiveDashboardLogger.Hooks ] ``` -------------------------------- ### Log struct type definition Source: https://hexdocs.pm/live_dashboard_logger/LiveDashboardLogger.Log.html Defines the Log struct type with fields for id, level, message, metadata, node, and timestamp. The timestamp field uses the timestamp() type defined separately. ```elixir @type t() :: %LiveDashboardLogger.Log{ id: term(), level: Logger.level(), message: String.t(), metadata: Keyword.t(), node: node(), timestamp: timestamp() } ``` -------------------------------- ### Timestamp type definition Source: https://hexdocs.pm/live_dashboard_logger/LiveDashboardLogger.Log.html Defines the timestamp type as a tuple with date and time components, where the date is a tuple of year, month, and day, and the time is a tuple of hour, minute, second, and millisecond. ```elixir @type timestamp() :: {{1970..9999, 1..12, 1..31}, {0..23, 0..59, 0..59, 0..999}} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.