jevrecipes

Recipe catalog / log-line-kind

Classify what a log line reports

log-line-kind is a Jev recipe from the jev-recipes TypeScript package. What does line report: an error, a warning, a lifecycle event, a handled request, a metric, or debug output? Use it when you are grouping or filtering unstructured log lines from mixed sources and cannot rely on a level field being present or accurate.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I use log-line-kind in TypeScript?

Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.

import { logLineKind } from 'jev-recipes/log-line-kind';

const result = await logLineKind({
  "line": "2026-09-23T14:02:11Z WARN db.pool: connection pool at 87% capacity, above the 80% threshold; new requests may queue",
  "minConfidence": 0.8
});
console.log(result);

What input does log-line-kind take?

FieldTypeNeeded
linestringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "line": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "line"
    ]
  },
  "result": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "model": {
        "type": "string"
      },
      "usage": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "output_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "input_tokens",
          "output_tokens"
        ],
        "additionalProperties": false
      },
      "status": {
        "type": "string",
        "enum": [
          "ready",
          "review"
        ]
      },
      "verdict": {
        "type": "string",
        "enum": [
          "error",
          "warning",
          "lifecycle",
          "request",
          "metric",
          "debug",
          "unclear"
        ]
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "enum": [
            "error",
            "warning",
            "lifecycle",
            "request",
            "metric",
            "debug",
            "unclear"
          ]
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "required": [
          "error",
          "warning",
          "lifecycle",
          "request",
          "metric",
          "debug",
          "unclear"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "verdict",
      "confidence",
      "probabilities"
    ],
    "additionalProperties": false
  }
}

What does a log-line-kind result look like?

This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo log-line-kind.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "verdict": "warning",
  "confidence": 0.82,
  "probabilities": {
    "error": 0.03,
    "warning": 0.82,
    "lifecycle": 0.01,
    "request": 0.01,
    "metric": 0.1,
    "debug": 0.02,
    "unclear": 0.01
  }
}

Input

See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.

Result

verdict is one of error, warning, lifecycle, request, metric, debug, unclear. unclear means the supplied facts do not establish a decision and always requires review.

A result is ready when confidence meets minConfidence and the verdict is not unclear. Inspect the verdict as well as the status: a ready result can name an outcome your application treats as negative. probabilities covers every verdict.

Reuse and calls

Uses the shared choice helper for the Jev call and response parsing. This folder owns its question, verdict criteria, and review policy. A live invocation makes one logical Jev request.

Limits

The verdict describes one line in isolation. A stack-trace continuation, a bare number, or a line that only makes sense next to its neighbours may come back unclear, and application code should group multi-line records before classifying them. The recipe does not parse timestamps, request IDs, or numeric fields, and it does not decide whether an error is worth paging on.

Example input

demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo log-line-kind shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe log-line-kind to inspect the input and result schemas.

How accurate is log-line-kind?

Fixture only

No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.

Use the evaluation guide to measure this decision on your own labeled cases.

What are the limits of log-line-kind?