← All procedures

node.logs

The output of a process of node.spawn: the last 64 KiB of stdout and stderr, or with follow a stream of its lines

CLI
Package
@procedures/node · README
Path
["node","logs"]
CLI
mark node logs --processId <string>
As data
{"$proc":["node","logs"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/node/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["node","logs"], { processId: "<processId>" });
console.log(JSON.stringify(result));

From the command line

$ mark node logs --processId <string>

As data, in a program

{ "$proc": ["node", "logs"], "input": { "processId": "<processId>" } }

Input

FieldTypeRequiredDefaultDescription
processIdstringyesProcess ID returned from node.spawn
linesintegernoOnly the last lines of the output
stripAnsibooleannoRemove the ANSI escape codes (colors) from the output
followbooleannoGive a stream: the kept output, then each new line, until the process ends or the caller aborts

Output

The schema does not list fields (object | object | object | object).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "processId": {
        "type": "string",
        "minLength": 1,
        "description": "Process ID returned from node.spawn"
      },
      "lines": {
        "description": "Only the last lines of the output",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "stripAnsi": {
        "description": "Remove the ANSI escape codes (colors) from the output",
        "type": "boolean"
      },
      "follow": {
        "description": "Give a stream: the kept output, then each new line, until the process ends or the caller aborts",
        "type": "boolean"
      }
    },
    "required": [
      "processId"
    ]
  },
  "output": {
    "anyOf": [
      {
        "type": "object",
        "properties": {
          "processId": {
            "type": "string",
            "description": "The id of the process"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "exited",
              "error"
            ],
            "description": "The state of the process"
          },
          "exitCode": {
            "description": "The exit code, when the process exited",
            "type": "number"
          },
          "output": {
            "type": "string",
            "description": "The end of the output: stdout and stderr together, the last 64 KiB"
          }
        },
        "required": [
          "processId",
          "status",
          "output"
        ],
        "additionalProperties": {}
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "output",
              "stdout",
              "stderr"
            ],
            "description": "The stream of the line: output for a line that the registry kept"
          },
          "line": {
            "type": "string",
            "description": "One line of the output, without its line end"
          }
        },
        "required": [
          "type",
          "line"
        ],
        "additionalProperties": {}
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "dropped",
            "description": "A gap: the reader was slow"
          },
          "bytes": {
            "type": "number",
            "description": "The number of bytes that the stream dropped"
          }
        },
        "required": [
          "type",
          "bytes"
        ],
        "additionalProperties": {}
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "exit",
            "description": "The end of the process and of the stream"
          },
          "status": {
            "type": "string",
            "enum": [
              "exited",
              "error"
            ],
            "description": "The state of the process at its end"
          },
          "exitCode": {
            "description": "The exit code, when the process exited",
            "type": "number"
          },
          "signal": {
            "description": "The signal that ended the process",
            "type": "string"
          }
        },
        "required": [
          "type",
          "status"
        ],
        "additionalProperties": {}
      }
    ]
  }
}