• Stars
    star
    160
  • Rank 226,507 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple logging

Scrolls

Scrolls is a library for generating logs of the structure key=value.

Installation

Add this line to your application's Gemfile:

gem 'scrolls'

And then execute:

$ bundle

Or install it yourself as:

$ gem install scrolls

Philosophy

Scrolls follows the belief that logs should be treated as data. One way to think of them is the blood of your infrastructure. Logs are a realtime view of what is happening on your systems.

Usage

0.9.0 and later

require 'scrolls'

Scrolls.init(
  timestamp: true,
  global_context: {app: "scrolls", deploy: "production"},
  exceptions: "multi"
)

Scrolls.log(at: "test")

Scrolls.context(context: "block") do
  Scrolls.log(at: "exec")
end

begin
  raise
rescue Exception => e
  Scrolls.log_exception(e, at: "raise")
end

You can also use Scrolls#log and Scrolls#log_exception without initalizing:

require 'scrolls'

Scrolls.log(test: "test")

Defaults

Here are the defaults Scrolls#init:

stream: STDOUT
facility: Syslog::LOG_USER
time_unit: "seconds"
timestamp: false
exceptions: "single"
global_context: {}
syslog_options: Syslog::LOG_PID|Syslog::LOG_CONS
escape_keys: false
strict_logfmt: false

Older Versions

Pre 0.9.0

require 'scrolls'

Scrolls.add_timestamp = true
Scrolls.global_context(:app => "scrolls", :deploy => "production")

Scrolls.log(:at => "test")

Scrolls.context(:context => "block") do
  Scrolls.log(:at => "exec")
end

begin
  raise
rescue Exception => e
  Scrolls.log_exception(:at => "raise", e)
end

Produces:

now="2017-09-01T00:37:13Z" app=scrolls deploy=production at=test
now="2017-09-01T00:37:13Z" app=scrolls deploy=production context=block at=exec
now="2017-09-01T00:37:13Z" app=scrolls deploy=production at=exception class=RuntimeError exception_id=70149797587080
now="2017-09-01T00:37:13Z" app=scrolls deploy=production at=exception class=RuntimeError exception_id=70149797587080 site="./test-scrolls.rb:16:in <main>"

History

This library originated from various logging methods used internally at Heroku. Starting at version 0.2.0 Scrolls was ripped apart and restructured to provide a better foundation for the future. Tests and documentation were add at that point as well.

Thanks to the following people for influencing this library.

  • Mark McGranaghan
  • Noah Zoschke
  • Mark Fine
  • Fabio Kung
  • Ryan Smith

LICENSE

MIT License

More Repositories

1

proclaim

Conditionally roll out features with redis. (Python version of James Golick's http://github.com/jamesgolick/rollout)
Python
91
star
2

comsat

Notifications
Ruby
42
star
3

django-proclaim

Use Proclaim to release features to target users inside your Django project.
Python
24
star
4

throttle

A tool to use for rate limiting
Ruby
11
star
5

zmqpy

Pure Python bindings for 0mq
Python
10
star
6

dotvim

Vim setup using redo and pathogen to manage plugins
Vim Script
8
star
7

misc-cassandra

Misc files related to my travels using the Cassandra database.
Python
6
star
8

liberty

Liberty Christian Church Song Presentation Software
HTML
6
star
9

emacs

Personal emacs configuration
Emacs Lisp
4
star
10

old-devcloud-cookbooks

The beginning of DevCloud's Chef configuration
Ruby
3
star
11

voon

An attempt at fancy design in a terminal IRC client.
PHP
3
star
12

bifrost

afd and gossip protocol stuff
Python
3
star
13

python-thriftclient

Python ThriftClient (mostly a clone of git://github.com/fauna/thrift_client.git)
Python
2
star
14

misc-python

misc Python code
Python
2
star
15

eyja

C
2
star
16

whitespace-ports

Whitespace specific FreeBSD ports
2
star
17

drbd-pm-iscsi-configs

This was the old configuration for Engine Yard Devcloud
Shell
2
star
18

whitespace-vim

Vim Theme: whitespace
Vim Script
1
star
19

vim

Vim configuration
Vim Script
1
star
20

misc-perl

misc Perl code
Perl
1
star
21

misc-lisp

misc Lisp code
Common Lisp
1
star
22

dotemacsd

Emacs configuration
Emacs Lisp
1
star
23

lisp

Personal lisp configuration
Common Lisp
1
star
24

nvim

nvim config
Lua
1
star
25

warfield

Pelham replacement
Go
1
star
26

searchparty

Route search queries and results.
Ruby
1
star