< documentation
Plugins
Extension Points
logging 1.0.x
usage
Configuring logging is very simple. All you need to understand is the notion of 'category' and 'level'.
A category is just a dot-delimited name, like 'Myapp.Controllers.Login'. This is a highly specific category, and if you logging configuration is specified, it will follow the configuration for 'Myapp.Controllers', then 'Myapp', and finally 'root'.
A level is a ceiling, and all messages under that ceiling are logged. DEBUG is the highest ceiling, then INFO, WARN, ERROR, and NONE follow in descending order. Setting a level to DEBUG mean you get all messages, DEBUG, INFO, WARN, ERROR, and EXCEPTION, while setting it to WARN means you only see WARN, ERROR, and EXCEPTION.
options
Loggers can be enabled or disabled, turned up or turned downed here. There are five levels for loggers, DEBUG, INFO, WARN, ERROR, and NONE. Each level will include log messages from higher levels but not lower. So DEBUG will print all messages while WARN will include error messages but not info and debug messages.
By default, all Categories that are not explicitly configured will use the 'root'
Name | Type | |
---|---|---|
category | String | |
A dot delimited namespace string | ||
level | String | |
one of 'DEBUG', 'INFO', 'WARN', 'ERROR', or 'NONE' |
examples
Here is a simple example logging configuration.
/* * @file app/configs/logging.js * @description If you need to peer into whats going on * under the hood in you application, but also want * to focus on an isolated area of code and not the * entire application you can turn up/down/on/off * logging categories */ (function($){ $.logging([ {category:"MyApp", level:"WARN"}, {category:"MyApp.Views", level:"INFO"}, {category:"MyApp.Controllers", level:"INFO"}, {category:"MyApp.Controllers.Hello", level:"DEBUG"}, {category:"Claypool", level:"WARN"}, {category:"Claypool.MVC", level:"INFO"}, {category:"root", level:"ERROR"} ]); })(jQuery);
Project
- app
- app/boot
- app/boot/client.js
- app/boot/server.js
- app/configs
- app/configs/config.js
- app/configs/environments.js
- app/configs/filters.js
- app/configs/logging.js
- app/configs/routes.js
- app/controllers
- app/controllers/example.js
- app/models
- app/models/example.js
- app/services
- app/services/example.js
- app/templates
- app/templates/example.js
- app/views
- app/views/example.js
- index.html
Guides
This guide is applicable to both the jquery-claypool client and server application frameworks. Where the two differ functionally the documentation will provide notes and examples of usage in each environment.