Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Eth3rnit3 committed Nov 22, 2023
1 parent 780fe45 commit 32ea2a6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ Or install it directly via the command line:
gem install datadog-json_logger
```

## Configuration
## Usage

Before using Datadog::JSONLogger, make sure to configure the necessary options. Add the following code to your application:
### JSONLogger
`Datadog::JSONLogger` offers powerful features that you can use in your Ruby application. Here's an example of usage:

```ruby
# In your initialization file
require 'datadog-json_logger'
# Example in sinatra (app.rb)
require 'datadog/json_logger'

Datadog::JSONLogger.configure do |config|
config.info_environments = %w[production demo]
config.app_name = ENV.fetch("APP_NAME", "set_APP_NAME_var")
config.environment = ENV.fetch("RACK_ENV", "development")
def logger
@logger ||= Datadog::JSONLogger.new
end
```

## Usage
set :logger, logger
```

Datadog::JSONLogger offers powerful features that you can use in your Ruby application. Here's an example of usage:
### SinatraMiddleware
`Datadog::SinatraMiddleware` allow rack request that formatted to JSON and monkey patch default `Rack::CommonLogger` to disable textual stdout

```ruby
# In your code
require 'datadog-json_logger'
# Example in sinatra (app.rb)
require 'datadog/sinatra_middleware'

# TODO
use Datadog::SinatraMiddleware, logger
```

## Contributing
Expand Down

0 comments on commit 32ea2a6

Please sign in to comment.