1.4.8 • Published 6 years ago

log_monitor v1.4.8

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

An API and CLI for remote node server monitoring, includes text coloring capabilities.

Monitor stdout and stderr while highlighting important information remotely.

Installation

	npm install -g log_monitor			

##Usage

###Opening and closing a port for remote monitoring

	const logServer = require("log_monitor");
	
	logServer.openLog(8000)
	.then(()=>{
		//handle open
	})	
	.catch((err)=>{
		//handle error
	});

	logServer.closeLog()			
	.then(()=>{
		//handle close
	})
	.catch((err)=>{
		//handle error
	});

###Connecting to an open port from command line

	log_monitor connect 8.8.8.8 8000	

###Linking a color specification:

color.json

{
	"ERROR:[0-9]" : {
		"fg" :"#343434",
		"bg" : "#FF4444",		
		"style" : "bold"
	},
	"CREDIT CARD READER" : {
		"fg" : "#808000",
		"style" : "underline"
	}
}
> invocation
log_monitor connect 8.8.8.8 8000 --color color.json			
![Imgur](https://i.imgur.com/quo77oO.gif)

##Events

**socket_open**<br/> 
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;socket : A net.Socket Object of connected TCP Socket [socket docs](https://nodejs.org/api/net.html#net_class_net_socket)

**socket_closed**<br/>
 &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;socket : A net.Socket Object of connected TCP Socket [socket docs](https://nodejs.org/api/net.html#net_class_net_socket)

**socket_data**<br/>
  &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;socket : A net.Socket Object of connected TCP Socket [socket docs](https://nodejs.org/api/net.html#net_class_net_socket)</br>
   &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;data: A byte buffer containing data sent by above socket

**socket_error**<br/> 
  &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;socket : A net.Socket Object of connected TCP Socket [socket docs](https://nodejs.org/api/net.html#net_class_net_socket)</br>
   &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;err: Some error

**server_error**.<br/>
    &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;err : Some error

```javascript

	const logServer = require("log_monitor");	

	logServer.on("socket_opened",(socket)=>{
		//handle connection
	});

	logServer.on("socket_closed",(socket)=>{
		//handle disconnect
	});

	logServer.on("socket_data",(socket,data)=>{
		//handle socket data
	});

	logServer.on("socket_error",(socket,err)=>{
		//handle error
	});

	logServer.on("server_error",(err)=>{
		//handle server error
	});

##DOCS

require("log_monitor").openLog(port)    Description:         Opens a TCP server on the input port for API.    Arguments:         port : Desired port number for log server.    Return:         A promise that resolves when the TCP server is successfully instantiated.

require("log_monitor").closeLog()    Description:         Closes TCP server opened by call to openLog - fails if server has not been open.    Arguments:         N/A    Return:         A promise that resolves when the TCP server is successfully closed.

1.4.8

6 years ago

1.4.7

6 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.14

6 years ago

1.2.13

6 years ago

1.2.12

6 years ago

1.2.11

6 years ago

1.2.10

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago