GithubHelp home page GithubHelp logo

sayuki0x / react-tail-printer Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.53 MB

A frontend for my websocket-tail server, using react.

License: GNU Affero General Public License v3.0

HTML 11.46% CSS 15.30% TypeScript 73.25%

react-tail-printer's Introduction

react-tail-printer

A front-end for my websocket-tail websocket server, written in react.

Setup

Dependencies

Installation

Clone the repository:

git clone https://github.com/ExtraHash/react-tail-printer

Change the directory into the repository you've cloned:

cd react-tail-printer

Install the dependencies

yarn

Fill out the config file with your own websocket host and port (the ones from your websocket-tail server you have running)

nano ./src/Config/config.json

This command will open it to edit in nano, but you can use whatever text editor you'd prefer.

Finally, start the application:

yarn start

Customization

You can customize the log output. Three methods of customization are currently available:

Styles

You can add custom css styles to each line of the log output based on a JSON file of values you provide, which is at src/Constants/styleConfig.json. Here's an example styleConfig.json:

{
  "success": {
    "strings": ["TurtleCoin", "[checkpoints]", "added to main chain"],
    "class": "has-text-success has-text-weight-bold"
  },
  "danger": {
    "strings": ["ERROR"],
    "class": "has-text-danger has-text-weight-bold"
  },
  "primary": {
    "strings": ["Stop signal sent"],
    "class": "has-text-primary has-text-weight-bold"
  },
  "violet": {
    "strings": ["==="],
    "class": "has-text-violet has-text-weight-bold"
  }
}

You can name the values anything you'd like. If the log has contains any of the strings in the value.strings array, it will apply the CSS class of whatever is in the value.class. Example: if my log output contains "TurtleCoin", a css class will be applied to the line of "has-text-success has-text-weight-bold". (From the success value).

You can place your custom css classnames in src/config/styles.css.

Removing substrings

Sometimes you might have substrings you want to completely remove from the log output. You can include an array of substrings at src/Config/substringsToRemove.json and react-tail-printer will trim them out of the log. Here's an example:

["[protocol]", "[Core]", "[daemon]", "[node_server]", "[RocksDBWrapper]"]

Ignoring lines

Sometimes you may not want to display specific lines at all in the log output. You can add any strings to an array at src/Config/linesToIgnore.json and if the log output contains any of the provided strings, it will not be displayed to the user. In this example, i'm removing some ASCII art by removing any lines that contain these specific characters:

["", "", "_", "|"]

react-tail-printer's People

Contributors

sayuki0x avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.