मजकुराकडे जा

Log टेम्पलेट

२० नवीनतम-प्रथम ओळींपर्यंतचा एक स्ट्रीमिंग फीड, प्रत्येक ओळीला ऐच्छिक टाइमस्टॅम्प आणि तीव्रता. सर्व्हर एक स्क्रोल-बॅक बॅकलॉग ठेवतो जो तुम्ही अॅपमध्ये मिळवू शकता, तर Live Activity नेहमी सर्वात अलीकडील ओळी दाखवते.

Live Activity प्रात्यक्षिक

Fields

FieldTypeDescription
templatestringRequired. Must be "log"
linesarrayRequired. 1–20 line objects, newest first (see below)
titlestringLog heading shown above the feed
statestringStatus text shown beside the title (e.g. the source name)
iconstringSF Symbol name (e.g. "doc.text") or MDI icon with mdi: prefix
accent_colorstringNamed color or hex used for the heading icon. Default: blue
background_colorstringBackground color override
text_colorstringText color override

Line object

Each entry in lines is an object:

FieldTypeDescription
textstringRequired. The log message. Max 512 characters
atintegerUnix timestamp (seconds) shown as the line's time
levelstringOne of info, warn, error — tints the line and its marker
माहिती

Send the newest line first, up to 20 lines per push. To stream a feed, prepend the new line and re-send the array. The Live Activity always shows the most recent lines that fit the ~4 KB APNs payload.

💡 टीप

The server keeps a rolling scroll-back backlog beyond what fits on screen. The PushWard app fetches it with GET /activities/{slug}?include=log_backlog to show full history in-app — the field is read-only and never needs to be sent.

Example: Streaming Deploy Log

स्ट्रीमिंग डिप्लॉय log
{
  "state": "ongoing",
  "content": {
    "template": "log",
    "title": "Deploy Log",
    "state": "pushward-server",
    "icon": "doc.text",
    "accent_color": "purple",
    "lines": [
      { "text": "Rollout complete — 3/3 pods healthy", "at": 1718990000, "level": "info" },
      { "text": "Image pull slow on node arm-2", "at": 1718989950, "level": "warn" },
      { "text": "Applied manifest revision d86246c", "at": 1718989930, "level": "info" },
      { "text": "Sync started by webhook", "at": 1718989900, "level": "info" }
    ]
  }
}

Typical Flow

  1. Start the feed (ended -> ongoing): Send the first batch of lines, newest first
  2. Append events (ongoing -> ongoing): Prepend each new line and re-send lines — older lines roll into the backlog
  3. Finish (ongoing -> ended): Send a closing line, then end the activity

Use Cases

  • CI/CD — live deploy and pipeline logs
  • Home automation — event feeds (motion, doors, presence)
  • Monitoring — rolling alert and incident streams
  • Self-hosting — download/import progress, backup steps, sync activity