From 615f65fd9815837f6841d67d7a10b1a3ecc77c65 Mon Sep 17 00:00:00 2001 From: Quang Ngoc Date: Sun, 29 Aug 2021 14:36:02 +0700 Subject: [PATCH 01/11] Update README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index adc35a7..7e9c12c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ 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. +- While you developing your front-end app and you have to switch back and forth between IDE and browser. +- When you want to test app on mobile need to check log. (See [Debug on mobile](#debug-on-mobile)) # How to use it? There are 2 ways and it depends on your preferences @@ -45,8 +46,6 @@ With `tconsole` command: - `--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 `tconsole` package: @@ -55,6 +54,14 @@ 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 Tconsole have 2 components: From 80ac875273a02661db101960501e9f6072ca5fd3 Mon Sep 17 00:00:00 2001 From: Quang Ngoc Date: Sun, 29 Aug 2021 14:36:30 +0700 Subject: [PATCH 02/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e9c12c..29c5d2a 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ To be able to stream log from your app running on mobile you need to : - 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})` +- Inside your project init tconfig with: `termlog({host: "YOUR_PRIVATE_IP"})` ## How it works Tconsole have 2 components: From ce89922be922bc17675a5edbbbc79fc46516785b Mon Sep 17 00:00:00 2001 From: Quang Ngoc Date: Sun, 29 Aug 2021 14:44:48 +0700 Subject: [PATCH 03/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29c5d2a..3d5e068 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 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 want to test app on mobile need to check log. (See [Debug on mobile](#debug-on-mobile)) +- When you test app on mobile and need to check log. (See [Debug on mobile](#debug-on-mobile)) # How to use it? There are 2 ways and it depends on your preferences From a22c2361b7e4ca5aa13980ab0c7893cb7d1eb4cd Mon Sep 17 00:00:00 2001 From: Quang Ngoc Date: Sun, 29 Aug 2021 14:45:22 +0700 Subject: [PATCH 04/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d5e068..643ce2c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ There are 2 ways and it depends on your preferences import termlog from "termlog" termlog() ``` -4. You should now see log being streamed to your terminal +5. You should now see log being streamed to your terminal __Note__: with this approach you might want to remove two lines above in production. From 84323c6c574541b23f775659b554595a088e04e3 Mon Sep 17 00:00:00 2001 From: Quang Ngoc Date: Sun, 29 Aug 2021 14:50:10 +0700 Subject: [PATCH 05/11] Update README.md --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 643ce2c..cccd16e 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ Bring browser console to your terminal ### What it does -termlog send the browser console log to your terminal. +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. +- 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](#debug-on-mobile)) # How to use it? @@ -24,9 +24,9 @@ termlog() ``` 5. You should now see log being streamed to your terminal -__Note__: with this approach you might want to remove two lines above in production. +__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. +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` @@ -36,10 +36,10 @@ By default termlog will __not__ run if it detects production mode using `NODE_EN 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. +__Note__: with this approach you have to do all steps 3-6 every-time you refresh your browser tab ## Advanced options -With `tconsole` command: +With `termlog` command: - `--out path`: Save log to file - `--port port`: Change server port - `--addr addr`: Change server address @@ -47,15 +47,15 @@ With `tconsole` command: > use `.show levels` while the server running to select again -With `tconsole` package: +With `termlog` package: -`tconsole({ +`termlog({ host: "localhost", port: 3456 })` ## Debug on mobile -To be able to stream log from your app running on mobile you need to : +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 @@ -64,9 +64,9 @@ To be able to stream log from your app running on mobile you need to : - Inside your project init tconfig with: `termlog({host: "YOUR_PRIVATE_IP"})` ## How it works -Tconsole have 2 components: -- [server.js](cli.js) - a websocket server to receive log from browser and display it -- [index.js](index.js) - tconsole package to import in your front end app. This package will override the default behavior of console object and send log to the server +Termlog have 2 components: +- [server.js](cli.js) - a websocket server to receive log message and display on terminal. +- [index.js](index.js) - termlog function to override default behavior of `console` object by capture arguments and send to websocket server ## Future release - [ ] Install using `