Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    nemeand
    @nemeand

    Hello, can someone please give me an example connection strin of replica set? I am trying with this
    db : 'mongodb://13.16.11.39,mongodb://13.16.11.72,mongodb://13.16.11.73/test?replicaSet=rs0' ,
    getting an error like:

    throw new Error('More than 1 database name in URL');
      ^

    Error: More than 1 database name in URL
    I wonder how it should look like?

    Winterwolf
    @Winterwolf
    @hellboy81 лично мой опыт мне подсказывает, что винстон просто не нужен. от него больше проблем, чем пользы. хотя я могу ошибаться.
    @hellboy81 к нему разве не прилагаются юнит-тесты?
    Yurij Mikhalevich
    @yurijmikhalevich

    теперь другая проблема - почему-то не все сообщения об ошибках сохраняются, например у меня ReferenceError: dddddd is not defined, в базу попадает ReferenceError, но поле message пустое :worried:

    Это странность какая-то. message должен нормально сохраняться.

    @hellboy81 А что интересно?
    @nemeand 'mongodb://13.16.11.39,13.16.11.72,13.16.11.73/test?replicaSet=rs0'
    Или ReferenceError это какой-то волшебный Error?
    Winterwolf
    @Winterwolf
    @39dotyt я не знаю, почему так происходит, но это в принципе и не проблема.
    @39dotyt возможно уже обновили, я давно не пользовался винстоном.
    nemeand
    @nemeand
    @39dotyt YESS!! and works Thanks Yurij! Trying winston-mongodb. It is great!
    Yurij Mikhalevich
    @yurijmikhalevich
    @nemeand ;-)
    @Winterwolf может быть.
    Derek Brown
    @DerekTBrown
    Hey @39dotyt is there any reason why version 1.6.0 is not on NPM?
    Yurij Mikhalevich
    @yurijmikhalevich
    Hi!
    npm info winston-mongodb version
    1.6.0
    It's here, actually.
    published 4 weeks ago
    Collignon-Ducret Rémi
    @miton18
    Hi everyone !
    Collignon-Ducret Rémi
    @miton18
    I make a PR for typescript support, "it's work for me" but anyone can test it ?
    smdevpod
    @smdevpod
    Could anyone help with this? I am actually intrested what the answer is - http://stackoverflow.com/questions/38895265/log-a-mongoose-db-entry-using-winston-node-js
    Yurij Mikhalevich
    @yurijmikhalevich
    Hi @miton18. Thank you for the PR. I will test and review it ASAP.
    Cyril Su
    @liril-net
    Hi there, why will this library broke into a new library outside of winston? I have used typescript and i have found that definitions for winston do not support for mongodb transport.
    Rohin Gopalakrishnan
    @rohinrohin
    Hey I am trying to use mongoose to log the data.
    How do I pass the db object from mongoose to winston's option parameter?
    Yurij Mikhalevich
    @yurijmikhalevich

    Hi there, why will this library broke into a new library outside of winston?

    Can you show it to me?

    I have used typescript and i have found that definitions for winston do not support for mongodb transport.
    There typescript definitions in winston-mongodb.
    I think that if there are any problems they have to be fixed. This library is a part of winston.

    How do I pass the db object from mongoose to winston's option parameter?

    Haven't tested it with mongoose but some folks made it work. I suppose you have to pass an underlying mongodb object to it.

    Tom Bonanno
    @obsessiveprogrammer
    Hello. I'm having some trouble using an existing Promise<db> with this module and was wondering if anyone can help. Everything seems in order, but I must be missing something.
    Here's the relevant code:
    ./modules/logger.js

    const winston = require('winston');
    require('winston-mongodb').MongoDB;

    const logger = new winston.Logger();

    if (process.env.NODE_ENV == 'development') {
    logger.add(winston.transports.Console, {
    level: 'silly',
    colorize: true
    });
    }

    logger.add(winston.transports.MongoDB, {
    db: require('./mongodb'),
    collection: 'logs',
    level: 'warn',
    handleExceptions: true
    });

    winston.exitOnError = false;

    module.exports = logger;

    ./modules/mongodb.js

    const MongoClient = require('mongodb').MongoClient;

    const config = require('../config');
    const logger = require('./logger');

    const connectUrl = mongodb://${config.mongodb.user}:${config.mongodb.password}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.database};

    module.exports = MongoClient.connect(connectUrl)
    .then(db => {
    logger.debug(Connected to MongoDB database "${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.database}");
    return db;
    });

    Tom Bonanno
    @obsessiveprogrammer
    I require ./modules/mongodb.js throughout my application and it works fine.
    When I try to run the app, I get:
    TypeError: db.createCollection is not a function
    at createCollection (c:\Users\tbona\Dropbox\Visual Studio Code Projects\Gifter\node_modules\winston-mongodb\lib\winston-mongodb.js:106:15)
    at process._tickCallback (internal/process/next_tick.js:109:7)
    at Timeout.Module.runMain [as _onTimeout] (module.js:606:11)
    at ontimeout (timers.js:386:11)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
    Tom Bonanno
    @obsessiveprogrammer
    Nevermind. I think I just figured it out. Looks like a circular dependency between my logger and mongodb modules. Oops. :-)
    Neville Mascarenhas
    @nevosial
    How do i get limited fields logged to my mongodb collection and not to meta.
    My collection currently looks like:
    {
    "_id" : ObjectId("5a12537d81b6b634cb7d4696"),
    "timestamp" : ISODate("2017-11-20T04:01:01.229Z"),
    "level" : "info",
    "message" : "GET /stylesheets/bootstrap.css 304 11ms",
    "meta" : {}
    }
    I want it to acheive the following:
    {
    "_id" : ObjectId("5a12537d81b6b634cb7d4696"),
    "timestamp" : ISODate("2017-11-20T04:01:01.229Z"),
    "level" : "info",
    "message" : "GET /stylesheets/bootstrap.css 304 11ms",
    "meta" : {}
    }
    Neville Mascarenhas
    @nevosial
    Sorry, im trying to achieve this:
    {
    "_id" : ObjectId("5a12537d81b6b634cb7d4696"),
    "timestamp" : ISODate("2017-11-20T04:01:01.229Z"),
    "level" : "info",
    "message" : "GET /stylesheets/bootstrap.css 304 11ms",
    "status": 200,
    "requestUrl": '/',
    "requestMethod": 'GET',
    "remoteIp": '::1'
    "meta" : {}
    }
    Basically , i want the request object params to be a part of the collection directly and not in the meta tag.
    Glen Martin
    @glenkalarikkal
    Hi guys, i have a simple use case.
    i got the required modules (winston and winston-mongodb) and added this to winston as per the npm page documentation.
    But when i try to log with winston.info('message'), i do not get any data stored in the server
    the conf is
    const mongo_log_options ={
    db : 'mongodb://XXXXXX',
    collection : 'request_log',
    level : 'info',
    };