@tsed/logger-rabbitmq
v6.7.8
Published
RabbitMQ appender module for @tsed/logger
Downloads
111
Maintainers
Readme
@tsed/logger-rabbitmq
A package of Ts.ED logger framework.
Features
Push log events to a RabbitMQ.
Installation
npm install --save @tsed/logger-rabbitmq
If you want to be sure that all messages have been sent before your programme exits, remember to call logger.shutdown()
.
Configuration
type
-rabbitmq
layout
-object
(optional, defaults tomessagePassThroughLayout
) - the layout to use for log events (see Layouts).options.host
-string
(optional, defaults to127.0.0.1
) - the location of the rabbitmq serveroptions.port
-integer
(optional, defaults to5672
) - the port the rabbitmq server is listening onoptions.username
-string
(optional, defaults toguest
) - username to use when authenticating connection to rabbitmqoptions.password
-string
(optional, defaults toguest
) - password to use when authenticating connection to rabbitmqoptions.routing_key
-string
(optional, defaults tologstash
) - rabbitmq message's routing_keyoptions.durable
-string
(optional, defaults to false) - will that RabbitMQ lose our queue.options.exchange
-string
(optional, defaults tolog
)- rabbitmq send message's exchangeoptions.mq_type
-string
(optional, defaults todirect
) - rabbitmq message's mq_typeoptions.vhost
-string
(optional, defaults to/
) - vhost to useoptions.shutdownTimeout
-integer
(optional, defaults to10000
) - maximum time in milliseconds to wait for messages to be sent during log4js shutdown.
Example
import {Logger} from "@tsed/logger";
import "@tsed/logger-rabbitmq";
const logger = new Logger("loggerName");
logger.appenders.set("stdout", {
type: "rabbitmq",
level: ["info"],
options: {
host: "127.0.0.1",
port: 5672,
username: "guest",
password: "guest",
routing_key: "logstash",
exchange: "exchange_logs",
mq_type: "direct",
durable: true
}
});
This configuration will push log messages to the rabbitmq on 127.0.0.1:5672
.
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
License
The MIT License (MIT)
Copyright (c) 2016 - 2018 Romain Lenzotti
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.