Install crafity-logging module via NPM installer or by cloning this repository from GitHub:
$ npm install crafity-logging
$ git clone https://github.com/Crafity/crafity-logging.git$ cd crafity-logging
Before you start using it you must install all its dependencies. They are listed in
package.json file under key
Install them first by running command on the terminal from
crafity-logging as current directory:
$ npm install
After the dependencies have been installed, run the unit tests to check the sanity of the module. From the command line
and current directory
crafity-logging type the command:
$ npm test
crafity-logging module bridges a configurable crafity web application infrastructure to logging procedures.
At the moment log4js module is used underneath except for minor changes that are wrapped up in crafity-log4js module.
crafity-log4js for more information.
Require logging module and and ask for a logger:
var logging =logger = logging;
nameString A name for the logger
categoryString A category for the logger
configObject An object literal with configuration
The following configuration example describes a logger with one console appender and one file appender:
type: file- this tells log4js to use the file appender
type: console- this tells log4js to use the console appender
category: ...- if omitted in the configuration, it can be passed as an argument in
createmethod and this will hold for all logger appenders.
keep: false- forget the default appenders on initialization
(The MIT License)
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.