-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loggly config file inconsistency between winston and node-loggly #7
Comments
So I think there is some confusion here. That format is for running the tests and not for use in code. In the case of node-loggly: var loggly = require('loggly');
var config = {
subdomain: "your-subdomain",
auth: {
username: "your-username",
password: "your-password"
}
};
var client = loggly.createClient(config); Whereas in winston: var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.Loggly)({
"subdomain": "your-subdomain",
"inputToken": "really-long-token-you-got-from-loggly",
"auth": {
"username": "your-username",
"password": "your-password"
}
})
]
}); Let me know if you run into anymore problems. |
I do think this is more about the core of how winston uses node-loggly, This may not be a battle worth fighting right now, may be a nitpick about In the case of node-loggly: Only subdomain is required to create a Loggly client, with auth creds from loggly/lib/loggly/core.js //
// function createClient (options)
// Creates a new instance of a Loggly client.
//
exports.createClient = function (options) {
return new Loggly(config.createConfig(options));
}; from loggly/lib/loggly/config.js //
// Config (defaults)
// Constructor for the Config object
//
var Config = function (defaults) {
if (!defaults.subdomain) throw new Error('Subdomain is required to create
an instance of Config');
this.subdomain = defaults.subdomain;
this.auth = defaults.auth || null;
}; In the case of winston: Winston's Loggly Transport is tied to a specific input, and that input //
// function Loggly (options)
// Constructor for the Loggly transport object.
//
var Loggly = exports.Loggly = function (options) {
options = options || {};
if (!options.subdomain) throw new Error('Loggly Subdomain is required');
if (!options.inputToken && !options.inputName) throw new Error('Target
input token or name is required.');
if (!options.auth && options.inputName) throw new Error('Loggly
authentication is required');
this.name = 'loggly';
this.level = options.level || 'info';
this.logBuffer = [];
this.client = loggly.createClient({
subdomain: options.subdomain,
auth: options.auth || null
}); |
@marksoper Thanks for the detailed feedback here. The API design is centered around the fact that once an input is created it can be logged to. If a Loggly input is added without a valid input name or input token then logging messages could be potentially lost. Since you're already planning on using |
Makes sense. Thanks for the clarification. I've been working on some On Sun, May 15, 2011 at 11:51 PM, indexzero <
617-999-3047 |
This may just be a documentation issue, or perhaps it makes sense to fix:
The format for the config file in node-loggly
{
"subdomain": "your-subdomain",
"auth": {
"username": "your-username",
"password": "your-password"
},
"inputs": [{
"token": "your-really-long-token-you-got-when-you-created-an-http-input",
"id": 000 // ID of this input
}]
}
The format for loggly config in winston:
{
"transports": {
"loggly": {
"subdomain": "your-subdomain",
"inputToken": "really-long-token-you-got-from-loggly",
"auth": {
"username": "your-username",
"password": "your-password"
}
}
}
}
Why not modify winston to use the node-loggly config file format?
The text was updated successfully, but these errors were encountered: