From 4194d4f0537ba5a62ed6efbe6e0765d91d41f462 Mon Sep 17 00:00:00 2001 From: Timothy Stott Date: Thu, 17 Nov 2016 16:53:12 +0000 Subject: [PATCH 1/3] :see_no_evil: Fix CHANGELOG links --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1398645..72aed13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` @@ -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 From 7794c99b29e05bbc6ad962ac83c25a43c7b5abfc Mon Sep 17 00:00:00 2001 From: Timothy Stott Date: Thu, 17 Nov 2016 17:16:09 +0000 Subject: [PATCH 2/3] :beginner: Update README with tagged logger examples --- README.md | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 36c6ceb..7270ae7 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ``` @@ -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 ``` @@ -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" } ``` @@ -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 From 4a99eea0cba866e3dea032357467e753ae3ab2ed Mon Sep 17 00:00:00 2001 From: Timothy Stott Date: Mon, 21 Nov 2016 14:54:49 +0000 Subject: [PATCH 3/3] :beginner: Update README to install Loga from RubyGems --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7270ae7..16e20aa 100644 --- a/README.md +++ b/README.md @@ -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