Giter Site home page Giter Site logo

Comments (6)

ryanjones avatar ryanjones commented on July 24, 2024 1

Hey Matteo,

You can quick fix it like this:

config/environments/production.rb

MyApp::Application.configure do
  config.lograge.enabled = true

  # add time to lograge
  config.lograge.custom_options = lambda do |event|
    {:time => event.time}
  end
end

Should work in Rails 3.0 and up.

from lograge.

roidrage avatar roidrage commented on July 24, 2024

Matteo,

Sorry this is not clearer in the logs.

lograge doesn't concern itself with adding timestamps because that's a task for a LogFormatter, which can be configured for the logger used by everything in Rails and in lograge.

You can specify a custom formatter that logs a timestamp, replacing the default Rails one (https://github.com/rails/rails/blob/master/activesupport/lib/active_support/logger.rb#L46-51).

You can replace it either with a custom formatter or use the one built into Ruby's logger library, Logger::Formatter, which also logs a timestamp.

from lograge.

seanlinsley avatar seanlinsley commented on July 24, 2024

I use this :)

from lograge.

DougPuchalski avatar DougPuchalski commented on July 24, 2024

+1 for example in docs

from lograge.

roidrage avatar roidrage commented on July 24, 2024

Added an example to the README.

from lograge.

patrickdavey avatar patrickdavey commented on July 24, 2024

I didn't like the time format the event gave me in #15 (comment) . Just using the Time class worked neatly for me.

MyApp::Application.configure do
  config.lograge.enabled = true

  # add time to lograge
  config.lograge.custom_options = lambda do |event|
    {
       time: Time.now.utc
    }
  end
end

from lograge.

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.