Console log to terminal

Overview

Termlog

Console log to terminal

What it does

termlog send the browser console log to your terminal

It also comes with a nodejs REPL so you can do some basic draft code

When to use it

  • While you developing your front-end app and you have to switch back and forth between IDE and browser
  • When you test app on mobile and need to check log. (See Debug on mobile)

How to use it?

There are 2 ways and it depends on your preferences

Recommended way

  1. Install the termlog binary : npm install --save-dev termlog ( you also can install globally with npm install -g termlog )
  2. Start server npx termlog or termlog if you install globally
  3. Go to the entry file of your project (I.e: app.jsx for React or main.js for Vue)
  4. Insert these two lines:
import termlog from "termlog"
termlog()
  1. You should now see log being streamed to your terminal

Note: with this approach you might want to remove two lines above in production

By default termlog will not run if it detects production mode using NODE_ENV, but you shouldn't rely on that

I don't want to add dependencies to my project

  1. Install the termlog binary : npm install -g termlog
  2. Start server termlog
  3. Go to your browser and open the console window
  4. Copy code inside index.js file without the last export line into console
  5. Enter termlog() into console
  6. You should now see log being streamed to your terminal

Note: with this approach you have to do all steps 3-6 every-time you refresh your browser tab

Advanced options

With termlog command:

  • --out path: Save log to file
  • --port port: Change server port
  • --addr addr: Change server address
  • --show levels: Select log levels to display (info | warning | error | debug). Multiple levels are seperated by ,

use .show levels while the server running to select again

With termlog package:

termlog({ host: "localhost", port: 3456 })

Debug on mobile

To be able to stream log from your app running on mobile you need to:

  • Start term log with 0.0.0.0 by running npx termlog --addr 0.0.0.0
  • Find your private IP address
    • MacOS: run ipconfig getifaddr en0 if you're on wifi and
    • Linux: run hostname -I
    • Windows: run ipconfig and find in the printed result. It should be under 192.168.x.x
  • Inside your project init tconfig with: termlog({host: "YOUR_PRIVATE_IP"})

How it works

Termlog have 2 components:

  • server.js - a websocket server to receive log message and display on terminal.
  • index.js - termlog function to override default behavior of console object by capture arguments and send to websocket server

Future release

  • Install using <script/> tag
  • (Maybe) An extension to start termlog on browser so we don't have to install dependencies
  • (If possible) Browser console REPL instead of nodejs REPL
You might also like...

This code can be used to log activity on yours Polytoria Games.

This code can be used to log activity on yours Polytoria Games.

polyGameLogger This code can be used to log activity on yours Polytoria Games. current version: 0.1.1 Basic Setup First of all, you need to create a .

Jun 13, 2022

A progressive web app to help volunteers track their volunteering activities, register vet concerns and log incident reports.

POOPS - Pets of Older Persons 2022 Introduction This is a Next.js project bootstrapped with create-next-app. Getting Started First, install yarn: npm

Jan 3, 2023

Register your username, log into the app and create your list of a to-do with local storage.

Register your username, log into the app and create your list of a to-do with local storage.

Todofy Todofy is a web app to create your to-do list with local storage. Explore the docs » View Demo · Report Bug · Request Feature Table of Contents

Jun 30, 2022

Browser extension that enables you to Log-in as ANY address on ALL dapps

Browser extension that enables you to Log-in as ANY address on ALL dapps

Impersonator Extension Log-in as ANY address on ALL dapps. Impersonator injects into the dapps just like Metamask, but gives you the freedom to set cu

Dec 14, 2022

A NodeJS Console Logger with superpowers

LogFlake LogFlake is a NodeJS console logger with superpowers. It has the same API as the usual Console but with beautified output, a message header w

Oct 9, 2022

NpxCard - Write 'npx hariom' in your console.

npx Card This is my NPX card for connecting with me in console or terminal. ❣️ Just Hit npx hariom Will see you in console in just a minute 👀 Importa

Jul 26, 2022

Console for mobile browsers

Console for mobile browsers

中文 Eruda Console for Mobile Browsers. Demo Browse it on your phone: https://eruda.liriliri.io/ In order to try it for different sites, execute the scr

Jan 1, 2023

print faceit elo into the console/chat via telnet

Print MM Ranks and FaceIT elo ingame This tool uses telnet to interact with the console in CS:GO Description Gets faceit elo via the official faceit a

Sep 20, 2022
Comments
  • Port some of my previous commits

    Port some of my previous commits

    The output formatting and getting the output which gets logged on page load is crucial for me so I ported my changes. Maybe you find them useful, otherwise I will have to maintain my own fork anyway :)

    opened by philippdieter 5
Owner
Quang Ngoc
I code, Therefore I am
Quang Ngoc
Another logger in JS. This one offers a console.log-like API and formatting, colored lines and timestamps (or not if desired), all that with 0 dependencies.

hellog Your new logger ! hellog is a general-purpose logging library. It offers a console.log-like API and formatting, extensible type-safety colored

Maxence Lecanu 4 Jan 5, 2022
Style templates for console.log

sttyl Style templates for console.log. Usage This module is primarily intended for Deno and browsers. import { sttyl } from "https://deno.land/x/sttyl

Wayne Bloss 8 Dec 27, 2022
This is a toy, it is an enhanced version of console.log

uu-console Hi, this is a toy. When you use console.log to print some logs, this can help you do some useless things. What is uu-console Support built-

KK Liu 2 Sep 25, 2022
This is a full stack application where you can log all you places where you visited....-

Full Stack Travelling Log ?? ?? ✈️ This is a full stack application where you can log ✈️ your all places ?? ?? ?? you have visited .... ??️ ??️ ??️ Se

null 19 Sep 29, 2022
Chrome extension that uses vulnerabilities CVE-2021-33044 and CVE-2021-33045 to log in to Dahua cameras without authentication.

DahuaLoginBypass Chrome extension that uses vulnerability CVE-2021-33044 to log in to Dahua IP cameras and VTH/VTO (video intercom) devices without au

null 71 Nov 26, 2022
Get the last logs of your /var/log folder

var-log-crawler Get the last logs of your /var/log folder Requirements: Node installed. Hot to use: Rename .env.sample to .env and fill with your valu

David William Rigamonte 2 Jan 5, 2022
A simple to do list webpage where you can log the daily tasks you have to do, mark them as checked, modify them, reorder them and remove them. Made using HTML, CSS and JavaScript.

To-Do-List This Webpage is for an app called To-Do-List which helps you add, remove or check tasks you have to do. It is a simple web page which conta

Zeeshan Haider 9 Mar 12, 2022
A library to log for Scriptable.

scriptable-logger Logger is a library to log for Scriptable. Usage const Logger = importModule('logger'); Logger.log('log'); // 'log' in white color.

Kynako 1 Apr 29, 2022
Benefit cards API, create and store card data and log transactions

Valex ?? Benefit cards for companies and employees! ?? Tech used Overview An API to store benefit cards from companies to employees and log transactio

Felipe Ventura 2 Apr 25, 2022
A full stack application that uses an authentication system to allow FAA Inspectors, Airliners, and Aircraft Technicians to update progress on their work all while keeping a log of records on projects completed.

A full stack application that uses an authentication system to allow FAA Inspectors, Airliners, and Aircraft Technicians to update progress on their work all while keeping a log of records on projects completed.

BinaryBitBytes 3 Jun 13, 2022