Giter VIP home page Giter VIP logo

Comments (5)

le0pard avatar le0pard commented on June 12, 2024

Record to log saved after exit the controller action. What exactly problem you want to solve? Notificate something about error?

from mongodb_logger.

ericmnel avatar ericmnel commented on June 12, 2024

I'm keeping a separate database of unique error conditions (if I have seen the error string before I just update the timestamp on the record, otherwise I save a new record) because the error logs were getting lost in the huge volume of normal logs. If I added the url to the mongo record to my new database, I would have not only a list of all outstanding issues, but a click link to the context that the error occurred in with all the other logs for that situation as well.

I suppose that the best thing might be for me to save the error logs in a session variable, and update them all when the mongo log is saved.

from mongodb_logger.

le0pard avatar le0pard commented on June 12, 2024

If I added the url to the mongo record to my new database, I would have not only a list of all outstanding issues, but a click link to the context that the error occurred in with all the other logs for that situation as well.

Ok, I understand. How about some callback? I can add in logger callback option, which will call some code on error. For example:

MongodbLogger.configure do |config|
  config.on_error do |mongo_record|
    # do something with this record
  end
end

from mongodb_logger.

ericmnel avatar ericmnel commented on June 12, 2024

That would be fantastic, thanks!

from mongodb_logger.

le0pard avatar le0pard commented on June 12, 2024

Ok, I added such functionality:

MongodbLogger::Base.configure do |config|
  config.on_log_exception do |mongo_record|
    # do something with this data, for example - send email (better - by background job)
  end
end

But here little problem - we have all data, except "_id". This is because we do insert without waiting response from MongoDB for maximum speed. I think this should help you. I already release version 0.2.8 with this functionality.

from mongodb_logger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.