Merge pull request #109 from Dignifiedquire/fix-1
Misc code highlighting fixes in readme.md
This commit is contained in:
commit
6da6f3c90e
14
README.md
14
README.md
@ -42,9 +42,9 @@ var logger = log4js.getLogger();
|
|||||||
logger.debug("Some debug messages");
|
logger.debug("Some debug messages");
|
||||||
```
|
```
|
||||||
By default, log4js outputs to stdout with the coloured layout (thanks to [masylum](http://github.com/masylum)), so for the above you would see:
|
By default, log4js outputs to stdout with the coloured layout (thanks to [masylum](http://github.com/masylum)), so for the above you would see:
|
||||||
|
```bash
|
||||||
[2010-01-17 11:43:37.987] [DEBUG] [default] - Some debug messages
|
[2010-01-17 11:43:37.987] [DEBUG] [default] - Some debug messages
|
||||||
|
```
|
||||||
See example.js for a full example, but here's a snippet (also in fromreadme.js):
|
See example.js for a full example, but here's a snippet (also in fromreadme.js):
|
||||||
```javascript
|
```javascript
|
||||||
var log4js = require('log4js');
|
var log4js = require('log4js');
|
||||||
@ -53,7 +53,7 @@ var log4js = require('log4js');
|
|||||||
log4js.loadAppender('file');
|
log4js.loadAppender('file');
|
||||||
//log4js.addAppender(log4js.appenders.console());
|
//log4js.addAppender(log4js.appenders.console());
|
||||||
log4js.addAppender(log4js.appenders.file('logs/cheese.log'), 'cheese');
|
log4js.addAppender(log4js.appenders.file('logs/cheese.log'), 'cheese');
|
||||||
```javascript
|
|
||||||
var logger = log4js.getLogger('cheese');
|
var logger = log4js.getLogger('cheese');
|
||||||
logger.setLevel('ERROR');
|
logger.setLevel('ERROR');
|
||||||
|
|
||||||
@ -65,10 +65,10 @@ logger.error('Cheese is too ripe!');
|
|||||||
logger.fatal('Cheese was breeding ground for listeria.');
|
logger.fatal('Cheese was breeding ground for listeria.');
|
||||||
```
|
```
|
||||||
Output:
|
Output:
|
||||||
|
```bash
|
||||||
[2010-01-17 11:43:37.987] [ERROR] cheese - Cheese is too ripe!
|
[2010-01-17 11:43:37.987] [ERROR] cheese - Cheese is too ripe!
|
||||||
[2010-01-17 11:43:37.990] [FATAL] cheese - Cheese was breeding ground for listeria.
|
[2010-01-17 11:43:37.990] [FATAL] cheese - Cheese was breeding ground for listeria.
|
||||||
|
```
|
||||||
The first 5 lines of the code above could also be written as:
|
The first 5 lines of the code above could also be written as:
|
||||||
```javascript
|
```javascript
|
||||||
var log4js = require('log4js');
|
var log4js = require('log4js');
|
||||||
@ -106,7 +106,7 @@ For FileAppender you can also pass the path to the log directory as an option wh
|
|||||||
log4js.configure('my_log4js_configuration.json', { cwd: '/absolute/path/to/log/dir' });
|
log4js.configure('my_log4js_configuration.json', { cwd: '/absolute/path/to/log/dir' });
|
||||||
```
|
```
|
||||||
If you have already defined an absolute path for one of the FileAppenders in the configuration file, you could add a "absolute": true to the particular FileAppender to override the cwd option passed. Here is an example configuration file:
|
If you have already defined an absolute path for one of the FileAppenders in the configuration file, you could add a "absolute": true to the particular FileAppender to override the cwd option passed. Here is an example configuration file:
|
||||||
|
```json
|
||||||
#### my_log4js_configuration.json ####
|
#### my_log4js_configuration.json ####
|
||||||
{
|
{
|
||||||
"appenders": [
|
"appenders": [
|
||||||
@ -127,7 +127,7 @@ If you have already defined an absolute path for one of the FileAppenders in the
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
```
|
||||||
Documentation for most of the core appenders can be found on the [wiki](log4js-node/wiki/Appenders), otherwise take a look at the tests and the examples.
|
Documentation for most of the core appenders can be found on the [wiki](log4js-node/wiki/Appenders), otherwise take a look at the tests and the examples.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
Loading…
Reference in New Issue
Block a user