mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
Merge pull request #670 from log4js-node/loggly-deprecation
chore: added loggly deprecation warning
This commit is contained in:
commit
29368cfcdb
@ -27,7 +27,6 @@ The following appenders are included with log4js. Some require extra dependencie
|
||||
* [hipchat](hipchat.md)
|
||||
* [logFaces-HTTP](logFaces-HTTP.md)
|
||||
* [logFaces-UDP](logFaces-UDP.md)
|
||||
* [loggly](loggly.md)
|
||||
* [logLevelFilter](logLevelFilter.md)
|
||||
* [logstashHTTP](logstashHTTP.md)
|
||||
* [logstashUDP](logstashUDP.md)
|
||||
@ -47,6 +46,7 @@ The following appenders are included with log4js. Some require extra dependencie
|
||||
The following appenders are supported by log4js, but will issue deprecation warnings from version 2.6 onwards - they will be removed from the log4js core in version 3. If you are using these appenders, you should alter your dependencies to include them explicitly.
|
||||
|
||||
* [gelf](https://github.com/log4js-node/gelf)
|
||||
* [loggly](https://github.com/log4js-node/loggly)
|
||||
|
||||
For example, if you were previously using the gelf appender (`type: 'gelf'`) then you should add `@log4js-node/gelf` to your dependencies and change the type to `type: '@log4js-node/gelf'`.
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ There have been a few changes between log4js 1.x and 2.x (and 0.x too). You shou
|
||||
* [file appender](file.md), with configurable log rolling based on file size or [date](dateFile.md)
|
||||
* [SMTP appender](smtp.md)
|
||||
* [GELF appender](https://github.com/log4js-node/gelf)
|
||||
* [Loggly appender](loggly.md)
|
||||
* [Loggly appender](https://github.com/log4js-node/loggly)
|
||||
* [Logstash UDP appender](logstashUDP.md)
|
||||
* logFaces ([UDP](logFaces-UDP.md) and [HTTP](logFaces-HTTP.md)) appender
|
||||
* [multiprocess appender](multiprocess.md) (useful when you've got multiple servers but want to centralise logging)
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
# Loggly Appender
|
||||
|
||||
Sends logging events to [Loggly](https://www.loggly.com), optionally adding tags. This appender uses [node-loggly](https://www.npmjs.com/package/loggly), and you will need to include that in your dependencies if you want to use this appender. Consult the docs for node-loggly, or loggly itself, if you want more information on the configuration options below.
|
||||
|
||||
## Configuration
|
||||
|
||||
* `type` - `loggly`
|
||||
* `token` - `string` - your really long input token
|
||||
* `subdomain` - `string` - your subdomain
|
||||
* `tags` - `Array<string>` (optional) - tags to include in every log message
|
||||
|
||||
This appender will scan the msg from the logging event, and pull out any argument of the
|
||||
shape `{ tags: [] }` so that it's possible to add additional tags in a normal logging call. See the example below.
|
||||
|
||||
## Example
|
||||
|
||||
```javascript
|
||||
log4js.configure({
|
||||
appenders: {
|
||||
loggly: {
|
||||
type: 'loggly',
|
||||
token: 'somethinglong',
|
||||
subdomain: 'your.subdomain',
|
||||
tags: [ 'tag1' ]
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: ['loggly'], level: 'info' }
|
||||
}
|
||||
});
|
||||
|
||||
const logger = log4js.getLogger();
|
||||
logger.info({ tags: ['my-tag-1', 'my-tag-2'] }, 'Some message');
|
||||
```
|
||||
|
||||
This will result in a log message being sent to loggly with the tags `tag1`, `my-tag-1`, `my-tag-2`.
|
||||
@ -2,6 +2,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This appender has been deprecated.
|
||||
* Updates and bug fixes should be made against https://github.com/log4js-node/loggly
|
||||
*/
|
||||
const debug = require('debug')('log4js:loggly');
|
||||
const loggly = require('loggly');
|
||||
const os = require('os');
|
||||
@ -105,6 +109,9 @@ function logglyAppender(config, layout) {
|
||||
}
|
||||
};
|
||||
|
||||
// trigger a deprecation warning, with a pointer to the replacement lib
|
||||
app.deprecated = '@log4js-node/loggly';
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user