Coloured and styled console output, XML-like tag support for styling, write to log files in either plain text or HTML.
npm install cconsole
|1||downloads in the last day|
|30||downloads in the last week|
|48||downloads in the last month|
|Version||0.3.4 last updated a month ago|
|Keywords||console, terminal, colours, colors, output, log, logging|
Coloured and styled console output. Keep in mind that not all styles are available on all different types of consoles. Unix seems to have much wider support than Windows for example.
File logging options including support for HTML formatting or plain text.
As of version 0.2.0 (not backward compatible) I have removed most of the original functionality that was present. Primarily because I didn't use it for my own projects, secondly because it wasn't coded very well and thirdly because there are other modules out there that many already use.
This then serves as a much lighter alternative, which I myself still find very useful.
As of version 0.3.0 logging to files is available. Whether plain text or formatted HTML.
Install using npm:
npm install cconsole
var cconsole = require('cconsole');
Output to console with chosen colour or style without a new line break.
// Different formatting on the same line cconsole.string('Different '); cconsole.string('colours ', 'red'); cconsole.string('and ', 'yellow'); cconsole.string('styles', 'bg_purple'); cconsole.string(' '); cconsole.string('on', 'bg_green'); cconsole.string(' '); cconsole.string('the ', 'b'); cconsole.string('same ', 'aqua'); cconsole.string('line.\n', 'bg_red'); // or using tags... cconsole.log('Different <red>colours</red> <yellow>and</yellow> ' + '<bg=purple>styles</bg> <bg=green>on</bg> <b>the</b> <cyan>same</cyan> ' + '<bg=red>line.</bg>');
Output to console with chosen colour or style with a new line break.
cconsole.log('Different formatted lines.', 'blue'); cconsole.log('Different formatted lines.', 'yellow'); cconsole.log('Different formatted lines.', 'bg_white');
Output to a plain text file, includes time stamps automatically.
cconsole.text('Text goes here.');
Output to a HTML file, supports all formatting options (below) as well as direct HTML tags, as long as they don't conflict with the tags already defined.
Styles can be applied with the following XML-style tags:
<b>bold text</b> <i>italic text</i> <s>strikethrough text</s> <u>underlined text</u> <inverted>black text on white background</inverted>
<red>...</red> <blue>...</blue> <green>...</green> <purple>...</purple> <cyan>...</cyan> <yellow>...</yellow> <gray>...</gray>
<bg=red>...</bg> <bg=blue>...</bg> <bg=green>...</bg> <bg=purple>...</bg> <bg=cyan>...</bg> <bg=yellow>...</bg> <bg=gray>...</bg>
Only use tagging when outputting to the console or to HTML log files.
The MIT License (MIT) Copyright (c) 2014 Rory J. Bradford. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.