8000 Merge pull request #109 from Dignifiedquire/fix-1 · LikeABossProgrammer/log4js-node@6da6f3c · GitHub
[go: up one dir, main page]

Skip to content

Commit 6da6f3c

Browse files
author
Gareth Jones
committed
Merge pull request log4js-node#109 from Dignifiedquire/fix-1
Misc code highlighting fixes in readme.md
2 parents ec2f8fe + f478793 commit 6da6f3c

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

README.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ NOTE: from log4js 0.5 onwards you'll need to explicitly enable replacement of no
2121

2222
```javascript
2323
{
24-
appenders: [
25-
{ type: "console" }
26-
],
27-
replaceConsole: true
24+
appenders: [
25+
{ type: "console" }
26+
],
27+
replaceConsole: true
2828
}
2929
```
3030

@@ -42,9 +42,9 @@ var logger = log4js.getLogger();
4242
logger.debug("Some debug messages");
4343
```
4444
By default, log4js outputs to stdout with the coloured layout (thanks to [masylum](http://github.com/masylum)), so for the above you would see:
45-
46-
[2010-01-17 11:43:37.987] [DEBUG] [default] - Some debug messages
47-
45+
```bash
46+
[2010-01-17 11:43:37.987] [DEBUG] [default] - Some debug messages
47+
```
4848
See example.js for a full example, but here's a snippet (also in fromreadme.js):
4949
```javascript
5050
var log4js = require('log4js');
@@ -53,7 +53,7 @@ var log4js = require('log4js');
5353
log4js.loadAppender('file');
5454
//log4js.addAppender(log4js.appenders.console());
5555
log4js.addAppender(log4js.appenders.file('logs/cheese.log'), 'cheese');
56-
```javascript
56+
5757
var logger = log4js.getLogger('cheese');
5858
logger.setLevel('ERROR');
5959

@@ -65,18 +65,18 @@ logger.error('Cheese is too ripe!');
6565
logger.fatal('Cheese was breeding ground for listeria.');
6666
```
6767
Output:
68-
69-
[2010-01-17 11:43:37.987] [ERROR] cheese - Cheese is too ripe!
70-
[2010-01-17 11:43:37.990] [FATAL] cheese - Cheese was breeding ground for listeria.
71-
68+
```bash
69+
[2010-01-17 11:43:37.987] [ERROR] cheese - Cheese is too ripe!
70+
[2010-01-17 11:43:37.990] [FATAL] cheese - Cheese was breeding ground for listeria.
71+
```
7272
The first 5 lines of the code above could also be written as:
7373
```javascript
7474
var log4js = require('log4js');
7575
log4js.configure({
76-
appenders: [
77-
{ type: 'console' },
78-
{ type: 'file', filename: 'logs/cheese.log', category: 'cheese' }
79-
]
76+
appenders: [
77+
{ type: 'console' },
78+
{ type: 'file', filename: 'logs/cheese.log', category: 'cheese' }
79+
]
8080
});
8181
```
8282

@@ -106,28 +106,28 @@ For FileAppender you can also pass the path to the log directory as an option wh
106106
log4js.configure('my_log4js_configuration.json', { cwd: '/absolute/path/to/log/dir' });
107107
```
108108
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:
109-
110-
#### my_log4js_configuration.json ####
109+
```json
110+
#### my_log4js_configuration.json ####
111+
{
112+
"appenders": [
111113
{
112-
"appenders": [
113-
{
114-
"type": "file",
115-
"filename": "relative/path/to/log_file.log",
116-
"maxLogSize": 20480,
117-
"backups": 3,
118-
"category": "relative-logger"
119-
},
120-
{
121-
"type": "file",
122-
"absolute": true,
123-
"filename": "/absolute/path/to/log_file.log",
124-
"maxLogSize": 20480,
125-
"backups": 10,
126-
"category": "absolute-logger"
127-
}
128-
]
114+
"type": "file",
115+
"filename": "relative/path/to/log_file.log",
116+
"maxLogSize": 20480,
117+
"backups": 3,
118+
"category": "relative-logger"
119+
},
120+
{
121+
"type": "file",
122+
"absolute": true,
123+
"filename": "/absolute/path/to/log_file.log",
124+
"maxLogSize": 20480,
125+
"backups": 10,
126+
"category": "absolute-logger"
129127
}
130-
128+
]
129+
}
130+
```
131131
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.
132132

133133
## Documentation

0 commit comments

Comments
 (0)
0