https://github.com/sectly/logcon
Logcon is an free to use JavaScript library that provides nice console.log output with icons, tables and colors!
https://github.com/sectly/logcon
ascii color console javascript log logger logs nodejs npm table terminal
Last synced: 2 months ago
JSON representation
Logcon is an free to use JavaScript library that provides nice console.log output with icons, tables and colors!
- Host: GitHub
- URL: https://github.com/sectly/logcon
- Owner: Sectly
- License: mpl-2.0
- Created: 2022-10-06T19:01:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-13T10:43:51.000Z (over 3 years ago)
- Last Synced: 2025-03-12T00:39:59.170Z (over 1 year ago)
- Topics: ascii, color, console, javascript, log, logger, logs, nodejs, npm, table, terminal
- Language: JavaScript
- Homepage:
- Size: 106 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Logcon
Logcon is an free to use JavaScript library that provides nice console.log output with icons, tables and colors!
NPM: `npm i logcon` [(NPM Package)](https://www.npmjs.com/package/logcon)
Contact Me: https://www.sectly.online/#contact
```js
const logcon = require("logcon");
logcon.warn("This is a warning!");
logcon.error("This is a error!");
logcon.log("This is a log!");
logcon.debug("This is a debug!");
logcon.success("This is a success!");
logcon.stress("This is a stress!");
logcon.info("This is a info!");
logcon.output("This is a output!");
```

## New Since 1.0.3: Tables And More API Functions!
### Tables:
```js
const logcon = require("logcon");
const header = ["Id:", "Name:", "Status:"];
const body = [
["#1", "Sectly", "Online", "Working On Stuff"],
["#2", "Mike", "Idle"],
["#3", "Dan", "Offline"]
];
let newtable = new logcon.Table(header, body);
newtable.log(3); // Colors: 0 = Default, 1 = Red, 2 = Green, 3 = Yellow, 4 = Blue, 5 = Purple, 6 = Dark Blue, 7 = White, 8 = Whiteish. (Default = White)
newtable.setHeader(["Id:", "Name:", "Status:", "Extra:"]); // Set Header
newtable.appendBody(["#2", "Mike", "Idle"]); // Append Body
newtable.setBody([["#3", "Dan", "Offline"]]); // Set Body
const tableArray = newtable.array(); // Convert To Array
const tableString = newtable.string(); // Convert To String
newtable.log(); // Log In Console, Defaults To The Default Color With No Color Input
newtable.reset(); // Clear/Reset The Table
newtable.reset()
.setHeader(["Id:", "Name:", "Status:"])
.appendBody(["#1", "Sectly", "Online", "Working On Stuff"]);
let string = newtable.string();
console.log(string); // Or logcon.debug("Logcon Table:\n" + string);
```

### API Functions:
```js
const logcon = require("logcon");
const color = logcon.color(4); // Colors: 0 = Default, 1 = Red, 2 = Green, 3 = Yellow, 4 = Blue, 5 = Purple, 6 = Dark Blue, 7 = White, 8 = Whiteish. (Default = White)
console.log(color + "Hello!" + logcon.color(7));
const icon = logcon.icon(4); // Icons: 0 = ×, 1 = √, 2 = ‼, 3 = i, 4 = ⟫, 5 = », 6 = >, 7 = ?, 8 = ›
console.log("[" + icon + "]", logcon.icon(1));
const logger = logcon.type(7); // Types: 1 = Error, 2 = Success, 3 = Warn, 4 = Info, 5 = Stress, 6 = Debug, 7 = Log, 8 = Output.
logger("Logcon Time!");
```
