Pushing changes
This commit is contained in:
1
node_modules/console-stamp/.idea/.name
generated
vendored
Normal file
1
node_modules/console-stamp/.idea/.name
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
node-console-stamp
|
23
node_modules/console-stamp/.idea/compiler.xml
generated
vendored
Normal file
23
node_modules/console-stamp/.idea/compiler.xml
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
3
node_modules/console-stamp/.idea/copyright/profiles_settings.xml
generated
vendored
Normal file
3
node_modules/console-stamp/.idea/copyright/profiles_settings.xml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
5
node_modules/console-stamp/.idea/encodings.xml
generated
vendored
Normal file
5
node_modules/console-stamp/.idea/encodings.xml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
16
node_modules/console-stamp/.idea/inspectionProfiles/Project_Default.xml
generated
vendored
Normal file
16
node_modules/console-stamp/.idea/inspectionProfiles/Project_Default.xml
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="false" />
|
||||
<inspection_tool class="CssInvalidAtRule" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="JSUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="TaskInspection" enabled="false" level="INFO" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
7
node_modules/console-stamp/.idea/inspectionProfiles/profiles_settings.xml
generated
vendored
Normal file
7
node_modules/console-stamp/.idea/inspectionProfiles/profiles_settings.xml
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
7
node_modules/console-stamp/.idea/jsLibraryMappings.xml
generated
vendored
Normal file
7
node_modules/console-stamp/.idea/jsLibraryMappings.xml
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="file://$PROJECT_DIR$" libraries="{node-console-stamp/node_modules}" />
|
||||
<includedPredefinedLibrary name="Node.js Core" />
|
||||
</component>
|
||||
</project>
|
17
node_modules/console-stamp/.idea/jsLinters/jshint.xml
generated
vendored
Normal file
17
node_modules/console-stamp/.idea/jsLinters/jshint.xml
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JSHintConfiguration" version="2.4.4" use-config-file="false">
|
||||
<option bitwise="true" />
|
||||
<option browser="true" />
|
||||
<option curly="true" />
|
||||
<option eqeqeq="true" />
|
||||
<option forin="true" />
|
||||
<option maxerr="50" />
|
||||
<option noarg="true" />
|
||||
<option noempty="true" />
|
||||
<option nonew="true" />
|
||||
<option strict="true" />
|
||||
<option undef="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
9
node_modules/console-stamp/.idea/libraries/node_console_stamp_node_modules.xml
generated
vendored
Normal file
9
node_modules/console-stamp/.idea/libraries/node_console_stamp_node_modules.xml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="node-console-stamp node_modules">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/node_modules" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
5
node_modules/console-stamp/.idea/misc.xml
generated
vendored
Normal file
5
node_modules/console-stamp/.idea/misc.xml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="IdProvider" IDEtalkID="E8E4AAD01AFB32B8AEEFA693BA983A2C" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" />
|
||||
</project>
|
8
node_modules/console-stamp/.idea/modules.xml
generated
vendored
Normal file
8
node_modules/console-stamp/.idea/modules.xml
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/node-console-stamp.iml" filepath="$PROJECT_DIR$/.idea/node-console-stamp.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
20
node_modules/console-stamp/.idea/node-console-stamp.iml
generated
vendored
Normal file
20
node_modules/console-stamp/.idea/node-console-stamp.iml
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="node-console-stamp node_modules" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="PHP Runtime" type="php">
|
||||
<CLASSES>
|
||||
<root url="jar://$APPLICATION_PLUGINS_DIR$/php/lib/php.jar!/stubs/standard" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$APPLICATION_PLUGINS_DIR$/php/lib/php.jar!/stubs/standard" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
5
node_modules/console-stamp/.idea/scopes/scope_settings.xml
generated
vendored
Normal file
5
node_modules/console-stamp/.idea/scopes/scope_settings.xml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
124
node_modules/console-stamp/.idea/uiDesigner.xml
generated
vendored
Normal file
124
node_modules/console-stamp/.idea/uiDesigner.xml
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
7
node_modules/console-stamp/.idea/vcs.xml
generated
vendored
Normal file
7
node_modules/console-stamp/.idea/vcs.xml
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
1518
node_modules/console-stamp/.idea/workspace.xml
generated
vendored
Normal file
1518
node_modules/console-stamp/.idea/workspace.xml
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/console-stamp/.npmignore
generated
vendored
Normal file
2
node_modules/console-stamp/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
gfx/*
|
||||
test*
|
253
node_modules/console-stamp/README.md
generated
vendored
Normal file
253
node_modules/console-stamp/README.md
generated
vendored
Normal file
@ -0,0 +1,253 @@
|
||||
# console-stamp
|
||||
|
||||
[![npm][npm-image]][npm-url]
|
||||
[![downloads][downloads-image]][downloads-url]
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/console-stamp.svg?style=flat-square
|
||||
[npm-url]: https://npmjs.org/package/console-stamp
|
||||
[downloads-image]: https://img.shields.io/npm/dm/console-stamp.svg?style=flat-square
|
||||
[downloads-url]: https://npmjs.org/package/console-stamp
|
||||
|
||||
This module enables you to patch the console's methods in Node.js, to add timestamp prefix based on a given string pattern, and more...
|
||||
|
||||
## Usage ##
|
||||
|
||||
### Install
|
||||
|
||||
npm install console-stamp
|
||||
|
||||
### Patching the console
|
||||
|
||||
require("console-stamp")(console, [options]);
|
||||
|
||||
#### console
|
||||
The global console or [custom console](#customconsole).
|
||||
|
||||
#### options {Object|String}
|
||||
|
||||
From version 2.0 the second parameter is an object with several options. As a backward compatibillity feature this parameter can be a string containing the pattern.
|
||||
|
||||
* **options.pattern** {String}<br>A string with date format based on [Javascript Date Format](http://blog.stevenlevithan.com/archives/date-time-format)<br>**Default**: "ddd mmm dd yyyy HH:MM:ss"
|
||||
|
||||
* **options.formatter** {Function}<br>A custom date formatter that should return a formmatted date string.
|
||||
|
||||
* **options.label** {Boolean}<br>If true it will show the label (LOG | INFO | WARN | ERROR)<br>**Default**: true
|
||||
|
||||
* **options.include** {Array}<br>An array containing the methods to include in the patch<br>**Default**: ["log", "info", "warn", "error", "dir", "assert"]
|
||||
|
||||
* **options.exclude** {Array}<br>An array containing the methods to exclude in the patch<br>**Default**: [] \(none)
|
||||
|
||||
* **options.disable** {Array}<br>An array containing the methods to disable in the patch<br>**Default**: [] \(none)
|
||||
|
||||
* **options.level** {String}<br>A string choosing the most verbose logging function to allow. Ordered/grouped as such: "log dir", "info", "warn assert", "error"<br>**Default**: log
|
||||
|
||||
* **options.extend** {Object}<br>An object describing methods and their associated log level, to extend the existing `method <-> log level` pairs.<br>For an example see [Custom methods](#custommethods).
|
||||
|
||||
* **options.metadata** {String/Object/Function}<br>Types can be String, Object (interpreted with util.inspect), or Function. See the test-metadata.js for examples.<br>**Note** that metadata can still be sent as the third parameter (as in vesion 1.6) as a backward compatibillity feature, but this is deprecated. <br>**Default**: undefined
|
||||
|
||||
* **options.stdout** {WritableStream}<br>A custom `stdout` to use with [custom console](#customconsole).<br>**Default:** `process.stdout`
|
||||
|
||||
* **options.stderr** {WritableStream}<br>A custom `stderr` to use with [custom console](#customconsole).<br>**Default:** `options.stdout` or `process.stdout`
|
||||
|
||||
* **options.colors** {Object}<br>An object representing a color theme. More info [here](https://www.npmjs.com/package/chalk).
|
||||
|
||||
* **options.colors.stamp** {String/Array<String>/Function} <br>**Default:** []
|
||||
|
||||
* **options.colors.label** {String/Array<String>/Function} <br>**Default:** []
|
||||
|
||||
* **options.colors.metadata** {String/Array<String>/Function} <br>**Default:** []
|
||||
|
||||
Note: To combine colors, bgColors and style, set them as an array like this:
|
||||
|
||||
...
|
||||
stamp: ["black", "bgYellow", "underline"]
|
||||
...
|
||||
|
||||
|
||||
Or chain Chalk functions like this:
|
||||
|
||||
...
|
||||
stamp: require("chalk").red.bgYellow.underline;
|
||||
...
|
||||
|
||||
|
||||
Note also that by sending the parameter `--no-color` when you start your node app, will prevent any colors from console.
|
||||
|
||||
$ node my-app.js --no-color
|
||||
|
||||
### Example
|
||||
|
||||
// Patch console.x methods in order to add timestamp information
|
||||
require( "console-stamp" )( console, { pattern : "dd/mm/yyyy HH:MM:ss.l" } );
|
||||
|
||||
console.log("Hello World!");
|
||||
// -> [26/06/2015 14:02:48.062] [LOG] Hello World!
|
||||
|
||||
var port = 8080;
|
||||
console.log("Server running at port %d", port);
|
||||
// -> [26/06/2015 16:02:35.325] [LOG] Server running at port 8080
|
||||
|
||||
|
||||
|
||||
console.log( "This is a console.log message" );
|
||||
console.info( "This is a console.info message" );
|
||||
console.warn( "This is a console.warn message" );
|
||||
console.error( "This is a console.error message" );
|
||||
console.dir( {bar: "This is a console.dir message"} );
|
||||
|
||||
Result:
|
||||
|
||||
[26/06/2015 12:44:31.777] [LOG] This is a console.log message
|
||||
[26/06/2015 12:44:31.777] [INFO] This is a console.info message
|
||||
[26/06/2015 12:44:31.779] [WARN] This is a console.warn message
|
||||
[26/06/2015 12:44:31.779] [ERROR] This is a console.error message
|
||||
[26/06/2015 12:44:31.779] [DIR] { bar: 'This is a console.dir message' }
|
||||
|
||||
and
|
||||
|
||||
require( "console-stamp" )( console, {
|
||||
metadata: function () {
|
||||
return ("[" + process.memoryUsage().rss + "]");
|
||||
},
|
||||
colors: {
|
||||
stamp: "yellow",
|
||||
label: "white",
|
||||
metadata: "green"
|
||||
}
|
||||
} );
|
||||
|
||||
console.log( "This is a console.log message" );
|
||||
console.info( "This is a console.info message" );
|
||||
console.warn( "This is a console.warn message" );
|
||||
console.error( "This is a console.error message" );
|
||||
console.dir( {bar: "This is a console.dir message"} );
|
||||
|
||||
Result:
|
||||
|
||||

|
||||
|
||||
<a name="customconsole"></a>
|
||||
### Custom Console [v0.2.4+]
|
||||
|
||||
As of version 0.2.4 you can also create a custom console with its own `stdout` and `stderr` like this:
|
||||
|
||||
|
||||
```
|
||||
var fs = require( 'fs' );
|
||||
var output = fs.createWriteStream( './stdout.log' );
|
||||
var errorOutput = fs.createWriteStream( './stderr.log' );
|
||||
var logger = new console.Console( output, errorOutput );
|
||||
|
||||
console_stamp( logger, {
|
||||
stdout: output,
|
||||
stderr: errorOutput
|
||||
} );
|
||||
```
|
||||
|
||||
Everything is then written to the files.
|
||||
|
||||
**NOTE:** If `stderr` isn't passed, warning and error output will be sent to the given `stdout`.
|
||||
|
||||
|
||||
### Custom Formatter Example
|
||||
|
||||
Custom formatter using moment.js
|
||||
|
||||
var moment = require('moment');
|
||||
moment.locale('ja');
|
||||
|
||||
require( "console-stamp" )( console, {
|
||||
formatter:function(){
|
||||
return moment().format("LLLL");
|
||||
}
|
||||
} );
|
||||
|
||||
console.log( "This is a console.log message" );
|
||||
console.info( "This is a console.info message" );
|
||||
console.warn( "This is a console.warn message" );
|
||||
console.error( "This is a console.error message" );
|
||||
console.dir( {bar: "This is a console.dir message"} );
|
||||
|
||||
Result:
|
||||
|
||||
[2016年5月12日午前11時10分 木曜日] [LOG] This is a console.log message
|
||||
[2016年5月12日午前11時10分 木曜日] [INFO] This is a console.info message
|
||||
[2016年5月12日午前11時10分 木曜日] [WARN] This is a console.warn message
|
||||
[2016年5月12日午前11時10分 木曜日] [ERROR] This is a console.error message
|
||||
[2016年5月12日午前11時10分 木曜日] [DIR] { bar: 'This is a console.dir message' }
|
||||
|
||||
<a name="custommethods"></a>
|
||||
### Custom Methods
|
||||
|
||||
The **option.extend** option enables the extention or modification of the logging methods and their associated log levels:
|
||||
|
||||
The default logging methods and their log levels are as follows:
|
||||
|
||||
```javascript
|
||||
var levelPriorities = {
|
||||
log: 4,
|
||||
info: 3,
|
||||
warn: 2,
|
||||
error: 1,
|
||||
assert: 2,
|
||||
dir: 4
|
||||
};
|
||||
```
|
||||
|
||||
Combined with the **include** option, the **extend** option enables the usage of custom console logging methods to be used with this module, for example:
|
||||
|
||||
```javascript
|
||||
// Extending the console object with custom methods
|
||||
console.debug = function(msg) {
|
||||
console.log(msg);
|
||||
}
|
||||
console.fatal = function(msg) {
|
||||
console.log(msg);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Initialising the output formatter
|
||||
require('console-stamp')(console, {
|
||||
pattern: "HH:MM:ss",
|
||||
extend: {
|
||||
debug: 5,
|
||||
fatal: 0,
|
||||
},
|
||||
include: ["debug", "info", "warn", "error", "fatal"],
|
||||
level: "debug",
|
||||
});
|
||||
```
|
||||
|
||||
**Note** how the `log` method is omitted from the `include` list. Because the custom functions call `console.log` internally, including the `log` method would print double-formatted output.
|
||||
|
||||
### Adding Metadata ###
|
||||
|
||||
Types can be string, object (interpreted with util.inspect), or function.
|
||||
See the [test-metadata.js](https://github.com/starak/node-console-stamp/blob/master/test-metadata.js) for examples.
|
||||
|
||||
#### String example
|
||||
|
||||
require("console-stamp")(console, {
|
||||
pattern:"HH:MM:ss.l",
|
||||
metadata:'[' + process.pid + ']'
|
||||
});
|
||||
|
||||
console.log('Metadata applied.');
|
||||
|
||||
Result:
|
||||
|
||||
[26/06/2015 12:44:31.779] [LOG] [7785] Metadata applied.
|
||||
|
||||
#### Function example
|
||||
|
||||
var util = require("util");
|
||||
|
||||
require("console-stamp")(console, {
|
||||
pattern:"HH:MM:ss.l",
|
||||
metadata: function(){ return '[' + (process.memoryUsage().rss) + ']'; });
|
||||
|
||||
console.log('Metadata applied.');
|
||||
|
||||
Result:
|
||||
|
||||
[18:10:30.875] [LOG] [14503936] Metadata applied.
|
14
node_modules/console-stamp/defaults.json
generated
vendored
Normal file
14
node_modules/console-stamp/defaults.json
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"pattern": "",
|
||||
"include": ["log", "info", "warn", "error", "dir", "assert"],
|
||||
"exclude": [],
|
||||
"disable": [],
|
||||
"level": "log",
|
||||
"extend": {},
|
||||
"label": true,
|
||||
"colors": {
|
||||
"stamp":[],
|
||||
"label":[],
|
||||
"metadata":[]
|
||||
}
|
||||
}
|
176
node_modules/console-stamp/main.js
generated
vendored
Normal file
176
node_modules/console-stamp/main.js
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
/*jshint node:true, bitwise:false */
|
||||
/**
|
||||
*
|
||||
* Node Console stamp by Ståle Raknes
|
||||
*
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var defaultDateFormat = require( "dateformat" );
|
||||
var merge = require( "merge" );
|
||||
var chalk = require( "chalk" );
|
||||
var defaults = require( "./defaults.json" );
|
||||
var util = require( 'util' );
|
||||
|
||||
module.exports = function ( con, options, prefix_metadata ) {
|
||||
|
||||
// If the console is patched already, restore it
|
||||
if ( con.__ts__ && "restoreConsole" in con ) {
|
||||
con.restoreConsole();
|
||||
}
|
||||
|
||||
var pattern;
|
||||
|
||||
if ( typeof options === "string" ) {
|
||||
// Fallback to version 0.1.x
|
||||
pattern = options;
|
||||
options = merge( {}, defaults );
|
||||
} else {
|
||||
options = merge( {}, defaults, (options || {}) );
|
||||
pattern = options.pattern;
|
||||
prefix_metadata = prefix_metadata || options.metadata;
|
||||
}
|
||||
|
||||
var stdout = options.stdout;
|
||||
var stderr = options.stderr || options.stdout;
|
||||
|
||||
var levelPriorities = {
|
||||
log: 4,
|
||||
info: 3,
|
||||
warn: 2,
|
||||
error: 1,
|
||||
assert: 2,
|
||||
dir: 4
|
||||
};
|
||||
|
||||
//Extend log levels
|
||||
levelPriorities = merge( {}, levelPriorities, (options.extend || {}) );
|
||||
|
||||
var getAllowedLogFunctions = function ( level ) {
|
||||
var logFunctions = [],
|
||||
levelPriority = levelPriorities[level];
|
||||
|
||||
for ( var logFunction in levelPriorities ) {
|
||||
if ( levelPriorities.hasOwnProperty( logFunction ) ) {
|
||||
if ( levelPriority >= levelPriorities[logFunction] ) {
|
||||
logFunctions.push( logFunction );
|
||||
}
|
||||
}
|
||||
}
|
||||
return logFunctions;
|
||||
};
|
||||
|
||||
var dateFormat = options.formatter || defaultDateFormat,
|
||||
allowedLogFunctions = getAllowedLogFunctions( options.level );
|
||||
|
||||
options.disable = options.disable.concat( options.include.filter( function ( m ) {
|
||||
return !~options.exclude.indexOf( m ) && !~allowedLogFunctions.indexOf( m );
|
||||
} ) );
|
||||
|
||||
options.include = options.include.filter( function filter( m ) {
|
||||
return !~options.exclude.indexOf( m ) && !~options.disable.indexOf( m );
|
||||
} );
|
||||
|
||||
//SET COLOR THEME START
|
||||
var noColor = function ( str ) {
|
||||
return str;
|
||||
}; //Default behaviour (no color)
|
||||
|
||||
var getColor = function ( origColor ) {
|
||||
//If color is a chalk function already, just return it
|
||||
if ( typeof origColor === 'function' ) {
|
||||
return origColor;
|
||||
}
|
||||
//If color is an string, check if a function in chalk exists
|
||||
if ( typeof origColor === 'string' ) {
|
||||
return chalk["" + origColor] ? chalk["" + origColor] : noColor;
|
||||
}
|
||||
//If color is an array, check the contents for color strings
|
||||
if ( Array.isArray( origColor ) ) {
|
||||
if ( origColor.length > 0 ) {
|
||||
var color = chalk;
|
||||
for ( var i = 0; i < origColor.length; i++ ) {
|
||||
if ( typeof origColor[i] === 'string' ) {
|
||||
color = color["" + origColor[i]];
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
else {
|
||||
return noColor;
|
||||
}
|
||||
}
|
||||
return noColor;
|
||||
};
|
||||
|
||||
var colorTheme = {};
|
||||
colorTheme.stamp = getColor( options.colors.stamp );
|
||||
colorTheme.label = getColor( options.colors.label );
|
||||
colorTheme.metadata = getColor( options.colors.metadata );
|
||||
//SET COLOR THEME END
|
||||
|
||||
var original_functions = [];
|
||||
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
options.include.forEach( function ( f ) {
|
||||
|
||||
original_functions.push( [f, con[f]] );
|
||||
|
||||
var org = con[f];
|
||||
|
||||
con[f] = function () {
|
||||
|
||||
var prefix = colorTheme.stamp( "[" + dateFormat( pattern ) + "]" ) + " ";
|
||||
var args = slice.call( arguments );
|
||||
|
||||
// Add label if flag is set
|
||||
if ( options.label ) {
|
||||
prefix += colorTheme.label( "[" + f.toUpperCase() + "]" ) + " ".substr( f.length );
|
||||
}
|
||||
|
||||
// Add metadata if any
|
||||
var metadata = "";
|
||||
if ( typeof prefix_metadata === 'function' ) {
|
||||
metadata = prefix_metadata( f, args );
|
||||
} else if ( typeof prefix_metadata === 'object' ) {
|
||||
metadata = util.inspect( prefix_metadata );
|
||||
} else if ( typeof prefix_metadata !== 'undefined' ) {
|
||||
metadata = prefix_metadata;
|
||||
}
|
||||
|
||||
if ( metadata ) {
|
||||
prefix += colorTheme.metadata( metadata ) + " "; //Metadata
|
||||
}
|
||||
|
||||
if ( f === "error" || f === "warn" || ( f === "assert" && !args[0] ) ) {
|
||||
( stderr || process.stderr ).write( prefix );
|
||||
} else if ( f !== "assert" ) {
|
||||
( stdout || process.stdout ).write( prefix );
|
||||
}
|
||||
|
||||
return org.apply( con, args );
|
||||
|
||||
};
|
||||
} );
|
||||
|
||||
options.disable.forEach( function ( f ) {
|
||||
|
||||
original_functions.push( [f, con[f]] );
|
||||
|
||||
con[f] = function () { };
|
||||
|
||||
} );
|
||||
|
||||
con.restoreConsole = function () {
|
||||
original_functions.forEach( function ( pair ) {
|
||||
con[pair[0]] = pair[1];
|
||||
delete con.__ts__;
|
||||
} );
|
||||
delete con.restoreConsole;
|
||||
};
|
||||
|
||||
con.__ts__ = true;
|
||||
|
||||
};
|
123
node_modules/console-stamp/package.json
generated
vendored
Normal file
123
node_modules/console-stamp/package.json
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "console-stamp",
|
||||
"scope": null,
|
||||
"escapedName": "console-stamp",
|
||||
"name": "console-stamp",
|
||||
"rawSpec": "",
|
||||
"spec": "latest",
|
||||
"type": "tag"
|
||||
},
|
||||
"/home/burchettm/statsbot"
|
||||
]
|
||||
],
|
||||
"_from": "console-stamp@latest",
|
||||
"_id": "console-stamp@0.2.5",
|
||||
"_inCache": true,
|
||||
"_location": "/console-stamp",
|
||||
"_nodeVersion": "7.4.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/console-stamp-0.2.5.tgz_1483721163076_0.9857860836200416"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "starak",
|
||||
"email": "stale@raknes.net"
|
||||
},
|
||||
"_npmVersion": "4.0.5",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "console-stamp",
|
||||
"scope": null,
|
||||
"escapedName": "console-stamp",
|
||||
"name": "console-stamp",
|
||||
"rawSpec": "",
|
||||
"spec": "latest",
|
||||
"type": "tag"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/console-stamp/-/console-stamp-0.2.5.tgz",
|
||||
"_shasum": "8e88542165d8fcdcb3fa494f6df3dd15304cd6ff",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "console-stamp",
|
||||
"_where": "/home/burchettm/statsbot",
|
||||
"author": {
|
||||
"name": "Ståle Raknes",
|
||||
"email": "stale@raknes.net",
|
||||
"url": "http://github.com/starak"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/starak/node-console-stamp/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Ståle Raknes",
|
||||
"url": "http://github.com/starak"
|
||||
},
|
||||
{
|
||||
"name": "Jotham Read",
|
||||
"url": "https://github.com/jotham"
|
||||
},
|
||||
{
|
||||
"name": "Christiaan Westerbeek",
|
||||
"url": "https://github.com/devotis"
|
||||
},
|
||||
{
|
||||
"name": "Leon Lucardie",
|
||||
"url": "https://github.com/Gameleon12"
|
||||
},
|
||||
{
|
||||
"name": "Steffan Donal",
|
||||
"url": "https://github.com/SteffanDonal"
|
||||
},
|
||||
{
|
||||
"name": "Sören Schwert",
|
||||
"url": "https://github.com/sisou"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"chalk": "^1.1.1",
|
||||
"dateformat": "^1.0.11",
|
||||
"merge": "^1.2.0"
|
||||
},
|
||||
"description": "Patch NodeJS console methods in order to add timestamp information by pattern",
|
||||
"devDependencies": {
|
||||
"filesize": "^3.1.2",
|
||||
"moment": "^2.13.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8e88542165d8fcdcb3fa494f6df3dd15304cd6ff",
|
||||
"tarball": "https://registry.npmjs.org/console-stamp/-/console-stamp-0.2.5.tgz"
|
||||
},
|
||||
"gitHead": "02ebf882bb111cf2449f7c36e26303858d4f0eec",
|
||||
"homepage": "https://github.com/starak/node-console-stamp#readme",
|
||||
"keywords": [
|
||||
"console",
|
||||
"timestamp",
|
||||
"log",
|
||||
"jslog",
|
||||
"debug"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "main",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "starak",
|
||||
"email": "stale@raknes.net"
|
||||
}
|
||||
],
|
||||
"name": "console-stamp",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/starak/node-console-stamp.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.2.5"
|
||||
}
|
0
node_modules/console-stamp/stderr.log
generated
vendored
Normal file
0
node_modules/console-stamp/stderr.log
generated
vendored
Normal file
0
node_modules/console-stamp/stdout.log
generated
vendored
Normal file
0
node_modules/console-stamp/stdout.log
generated
vendored
Normal file
0
node_modules/console-stamp/stdout_stderr.log
generated
vendored
Normal file
0
node_modules/console-stamp/stdout_stderr.log
generated
vendored
Normal file
Reference in New Issue
Block a user