1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
Commit graph

19 commits

Author SHA1 Message Date
Zachary Scott
d8bf344710 Merge pull request #131 from dtaniwaki/add-required-params
Add required params method
2016-05-03 17:30:15 +09:00
yuuji.yaginuma
513917b67e change link to documentation for the latest release 2016-04-21 20:02:31 +09:00
dtaniwaki
eb3623ec3c Add required params method 2014-04-20 01:28:49 +09:00
Alexey Chernenkov
36e29bbac6 Add support for custom loggers (controlled via logger setting)
CustomLogger extension allows you to define your own logger instance
using +logger+ setting. That logger then will be available
as #logger helper method in your routes and views.

=== Classic Application

To define your custom logger instance in a classic application:

    require 'sinatra'
    require 'sinatra/custom_logger'
    require 'logger'

    set :logger, Logger.new(STDOUT)

    get '/' do
      logger.info 'Some message' # STDOUT logger is used
      # Other code...
    end

=== Modular Application

The same for modular application:

    require 'sinatra/base'
    require 'sinatra/custom_logger'
    require 'logger'

    class MyApp < Sinatra::Base
      helpers Sinatra::CustomLogger

      configure :development, :production do
        logger = Logger.new(File.open("#{root}/log/#{environment}.log", 'a'))
        logger.level = Logger::DEBUG if development?
        set :logger, logger
      end

      get '/' do
        logger.info 'Some message' # File-based logger is used
        # Other code...
      end
    end
2014-03-19 13:14:01 +06:00
Zachary Scott
07bfcfe764 Add links to documentation in README.md [Fixes #101] 2013-08-10 23:14:28 -04:00
Zachary Scott
71ae5e1098 TODO list is already completed 2013-03-25 09:34:50 -04:00
Matthew Conway
066a2a08a4 Fix typo in README 2013-02-07 14:42:34 -08:00
Samy Dindane
904b9889f9 Add installation instructions to the README 2012-09-22 00:59:35 +03:00
Trevor Bramble
a85488dc08 Add Travis CI build status to README 2012-06-17 23:42:24 -07:00
Eric Marden
b1439a5b39 fixes small omission in one of the examples 2012-02-01 13:02:02 -06:00
Konstantin Haase
57430546e2 add cookies extension 2011-09-04 18:13:40 -07:00
Konstantin Haase
70536c9ff5 add multi route extension 2011-09-04 18:13:27 -07:00
Konstantin Haase
f38fc52a8a remove Sinatra::Protection (part of Sinatra now) 2011-09-02 15:01:03 -06:00
Andrew Crump
35d2c0ddb3 Replace csrf example with protection. 2011-08-29 22:45:27 +01:00
Konstantin Haase
ec135d109d add ruby highlighting to readme 2011-05-24 19:50:01 +02:00
Konstantin Haase
923e8080af update readme 2011-05-09 08:36:48 +02:00
Konstantin Haase
cf6de883d0 move sinatra-decompile to custom extensions 2011-03-30 20:49:11 +02:00
Konstantin Haase
c5dcfe24a2 some README 2011-03-29 10:05:12 +02:00
Konstantin Haase
07a649ab6d initial commit 2011-03-24 08:43:39 +01:00