2.0.5 • Published 5 years ago

jtlog v2.0.5

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

JTLog

Build Status

JavascriptTypescriptLog (JTLog) is Log library.

Features

  • Simple Console logging.
  • Record/Store console logs for a particular session, return it in an array.
  • 2 Modes for development and production (Won't be visible to users).
  • Switch between consoling and recording, or choose both.

Installation

npm i jtlog --save

Usage

Javascript

// Include the module
var JT = require('jtlog');

TypeScript

import { JTLog } from 'jtlog';
JTLog.log("start", "App Started");

General

// To start the module 
// appname will be replaced by your program/app name
JT.start("appname");

// To change configuration
// setConfig(NAME, VALUE)
// NAME: <string> List can be found in Configuration list
// VALUE: <any> New value you wish to set
JT.setConfig("allowLog",true);

// To get configuration value
JT.getConfig("allowLog"); // This will return true by default

// To log something in console
// log(TAG, MSG, STYLE)
// TAG: <string> To tag the message | List can be found below
// MSG: <any> you message, it can also be a object
// STYLE: <string> <optional> very basic css style works
JT.log('default',"App started", "color:black");

//
// We are using just one function to log, cause this will avoid error
// In case you add wrong tag, this won't be a problem.
//


// To get the array of log history/record 
let record: any = JT.getLogRecord();

Note: JT is a module variable, It will be different for you, as you assign it.

Configuration List

NoNameTypeDescription
1allowLogBooleanTo decide if you wish to log or not
2allowRecordingBooleanTo allow recording of logs
3pageNameStringTo set file name of current page we are on.
4appNameStringName of app, it is set by user
5appStartTimeStringTime when app started

Tag List

NoTagDescription3
1defaultNormal log
2tablePrint table
3warnPrint Warning
4infoPrint Information
5startPrint Starting Heading
6callPrint when a function is called
7filePrint when a file is opened, also chances the fileName.
8errorPrint a error

File Structure

JTLog
|
├── src
│   ├── index.d.ts
│   └── index.js
├── test
│   └── test.js
├── art/..
├── node_modules/...
├── index.ts
├── LICENSE
├── package.json
├── package-lock.json
├── README.md
└── tsconfig.json

Contribution

Feel free to contribute.

Licence

Copyright 2018 Raman Tehlan < Ramantehlan@gmail.com >

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

2.0.5

5 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.2.0

7 years ago

1.1.33

7 years ago

1.1.32

7 years ago

1.1.31

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.8

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago