Tailed
  • Tailed
  • How it works
  • Zero-Install Web Tailer
    • Getting Started
    • Limitations
  • Command Line Tool
    • Installation
    • Reference
  • Client Libraries
    • .NET
    • Node JS
  • Colorization
    • Standard Rules
    • Custom Rules
  • Roadmap
  • GitHub Repositories
Powered by GitBook
On this page
  1. Colorization

Custom Rules

Understanding how to apply color to uncolored content.

Custom colorization rules can be provided in the form of a JSON file. An example of such a file is as foll

[
    {
        "name": "Information",
        "pattern": "^\\[(?<c>INF)\\]",
        "ignore_case": false,
        "foreground": "Green",
        "background": "Default",
        "first_only": true
    },
    {
        "name": "Warning",
        "pattern": "^\\[(?<c>WRN)\\]",
        "ignore_case": false,
        "foreground": "Black",
        "background": "Yellow",
        "first_only": true
    },
    {
        "name": "Datetime",
        "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3} [\\+\\-]?[0-9]{2}:[0-9]{2}",
        "ignore_case": false,
        "foreground": "Magenta",
        "background": "Default",
        "first_only": true
    }
]

name

This can be any name that helps you to identify the purpose of the rule. It's not used by Tailed itself.

pattern

This is a regular expression used to select the text for colorization. Ensure it is escaped correctly for JSON (e.g. \s would need to be encoded as \\s).

By default, the whole of the expression is colorized. If you'd prefer to only colorize a substring of the text, collect that text within a named group called c :

\\[(?<c>WRN)\\]

The regular expression is applied to the content on a line-by-line basis.

ignore_case

Whether or not the regular expression must be evaluated on a case-sensitive or case-insensitive basis.

foreground

The choice of font color. Possible choices are:

  • Default

  • Black

  • Red

  • Green

  • Yellow

  • Blue

  • Magenta

  • Cyan

  • White

  • BrightBlack

  • BrightRed

  • BrightGreen

  • BrightYellow

  • BrightBlue

  • BrightMagenta

  • BrightCyan

  • BrightWhite

background

The choice of background color. The list of possible choices are the same as for foreground.

first_only

If true, only the first instance of the text matching the regular expression within the line is colorized.

If false, every instance of text matching the regular expression within the line is colorized.

PreviousStandard RulesNextRoadmap

Last updated 1 year ago