Skip to content

Commit

Permalink
Merge pull request #95 from FundingCircle/documentation-update
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
timstott authored Nov 21, 2016
2 parents 3cc491c + 4a99eea commit ec44d28
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.0]
## [2.1.0] - 2016-11-17
## [2.1.0.pre.1]
### Changed
- Replace `ActiveSupport::Logger::SimpleFormatter` with `Loga::Formatters::SimpleFormatter`
Expand Down Expand Up @@ -48,7 +48,7 @@ when using simple format. The formatter adds level, timestamp, pid and tags prep
### Changed
- Silence ActionDispatch::DebugExceptions' logger

[2.1.0]: https://github.com/FundingCircle/loga/compare/v2.0.0...v2.0.0
[2.1.0]: https://github.com/FundingCircle/loga/compare/v2.0.0...v2.1.0
[2.1.0.pre.1]: https://github.com/FundingCircle/loga/compare/v2.0.0...v2.1.0.pre.1
[2.0.0]: https://github.com/FundingCircle/loga/compare/v1.4.0...v2.0.0
[2.0.0.pre.3]: https://github.com/FundingCircle/loga/compare/v2.0.0.pre.2...v2.0.0.pre.3
Expand Down
52 changes: 39 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Loga provides consistent logging across frameworks and environments.

Includes:
- One logger for all environments
- One tagged logger for all environments
- Human readable logs for development
- Structured logs for production ([GELF](http://docs.graylog.org/en/2.1/pages/gelf.html))
- One Rack logger for all Rack based applications
Expand All @@ -37,7 +37,7 @@ Includes:
Add this line to your application's Gemfile:

```
gem 'loga', git: 'git@github.com:FundingCircle/loga.git'
gem 'loga'
```

### Rails
Expand All @@ -47,7 +47,7 @@ Let Loga know what your application name is and Loga will do the rest.
```ruby
# config/application.rb
class MyApp::Application < Rails::Application
config.loga = { service_name: 'MyApp' }
config.loga = { service_name: 'my_app' }
end
```

Expand All @@ -68,7 +68,7 @@ class MyApp::Application < Rails::Application
config.loga = {
device: File.open("log/application.log", 'a'),
format: :gelf,
service_name: 'MyApp',
service_name: 'my_app',
}
end
```
Expand Down Expand Up @@ -173,21 +173,41 @@ Sinatra request output is identical to Rails but without the `_request.controlle
Logger output:

```ruby
Rails.logger.info('I love Loga')
# Rails.logger
# or
# Loga.logger

Loga.configure(service_name: 'my_app', format: :gelf)

Loga.logger.info('I love Loga')
Loga.logger.tagged(%w(USER_123 CRM)) do
Loga.logger.info('I love Loga with tags')
end
```

```json
{
"_service.name": "my_app",
"_service.version": "v1.0.0",
"_tags": "12345",
"_service.name": "my_app",
"_service.version": "v1.0.0",
"_tags": "",
"host": "example.com",
"level": 6,
"short_message": "I love Loga",
"timestamp": 1450150205.123,
"version": "1.1"
"level": 6,
"short_message": "I love Loga",
"timestamp": 1479402679.663,
"version": "1.1"
}
```

```json
{
"_service.name": "my_app",
"_service.version": "v1.0.0",
"_tags": "USER_123 CRM",
"host": "example.com",
"level": 6,
"short_message": "I love Loga",
"timestamp": 1479402706.102,
"version": "1.1"
}
```

Expand Down Expand Up @@ -216,11 +236,17 @@ I, [2016-11-15T16:10:08.645521+00:00 #1][12345] GET /ok 200 in 0ms type=request
Logger output:

```ruby
Loga.configure(service_name: 'my_app', format: :simple)

Loga.logger.info('I love Loga')
Loga.logger.tagged(%w(USER_123 CRM)) do
Loga.logger.info('I love Loga with tags')
end
```

```
I, [2015-12-15T09:30:05.123000+06:00 #999] I love Loga
I, [2016-11-17T17:07:46.714215+00:00 #595] I love Loga
I, [2016-11-17T17:07:46.725624+00:00 #595][USER_123 CRM] I love Loga with tags
```

## Road map
Expand Down

0 comments on commit ec44d28

Please sign in to comment.