All Projects → TwP → Logging

TwP / Logging

Licence: mit
A flexible logging library for use in Ruby programs based on the design of Java's log4j library.

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Logging

Concurrency Logger
Log HTTP requests/responses separately, visualize their concurrency and report logs/errors in context of a request.
Stars: ✭ 400 (-19.19%)
Mutual labels:  logging
Riemann
A network event stream processing system, in Clojure.
Stars: ✭ 4,099 (+728.08%)
Mutual labels:  logging
Oklog
Network logging interceptor for OkHttp. Logs an URL link with encoded network call data for every OkHttp call.
Stars: ✭ 474 (-4.24%)
Mutual labels:  logging
Python Coloredlogs
Colored terminal output for Python's logging module
Stars: ✭ 408 (-17.58%)
Mutual labels:  logging
Datasource Proxy
Provide listener framework for JDBC interactions and query executions via proxy.
Stars: ✭ 420 (-15.15%)
Mutual labels:  logging
Babel Plugin Sitrep
Log all assignments and the return value of a function with a simple comment
Stars: ✭ 442 (-10.71%)
Mutual labels:  logging
Onelog
Dead simple, super fast, zero allocation and modular logger for Golang
Stars: ✭ 389 (-21.41%)
Mutual labels:  logging
Faster
Fast persistent recoverable log and key-value store + cache, in C# and C++.
Stars: ✭ 4,846 (+878.99%)
Mutual labels:  logging
Izumi
Productivity-oriented collection of lightweight fancy stuff for Scala toolchain
Stars: ✭ 423 (-14.55%)
Mutual labels:  logging
Snoop
A powerful set of Python debugging tools, based on PySnooper
Stars: ✭ 467 (-5.66%)
Mutual labels:  logging
Clockwork Chrome
Clockwork - php dev tools integrated to your browser - Chrome extension
Stars: ✭ 415 (-16.16%)
Mutual labels:  logging
Log Process Errors
Show some ❤️ to Node.js process errors
Stars: ✭ 424 (-14.34%)
Mutual labels:  logging
Logstash Logger
Ruby logger that writes logstash events
Stars: ✭ 442 (-10.71%)
Mutual labels:  logging
Laravel Http Logger
Log HTTP requests in Laravel applications
Stars: ✭ 407 (-17.78%)
Mutual labels:  logging
Logary
Logs and metrics are one! Professional logging, metrics and analytics for your apps.
Stars: ✭ 479 (-3.23%)
Mutual labels:  logging
Gommon
Common packages for Go
Stars: ✭ 389 (-21.41%)
Mutual labels:  logging
Justlog
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.
Stars: ✭ 439 (-11.31%)
Mutual labels:  logging
Zerolog
Zero Allocation JSON Logger
Stars: ✭ 5,642 (+1039.8%)
Mutual labels:  logging
Log4rs
A highly configurable logging framework for Rust
Stars: ✭ 483 (-2.42%)
Mutual labels:  logging
Api Boot
“ ApiBoot”是为接口服务而生的,基于“ SpringBoot”完成扩展和自动配置,内部封装了一系列的开箱即用Starters。
Stars: ✭ 460 (-7.07%)
Mutual labels:  logging

Logging

by Tim Pease

Description

Logging is a flexible logging library for use in Ruby programs based on the design of Java's log4j library. It features a hierarchical logging system, custom level names, multiple output destinations per log event, custom formatting, and more.

Installation

gem install logging

Examples

This example configures a logger to output messages in a format similar to the core ruby Logger class. Only log messages that are warnings or higher will be logged.

require 'logging'

logger = Logging.logger(STDOUT)
logger.level = :warn

logger.debug "this debug message will not be output by the logger"
logger.warn "this is your last warning"

In this example, a single logger is created that will append to STDOUT and to a file. Only log messages that are informational or higher will be logged.

require 'logging'

logger = Logging.logger['example_logger']
logger.level = :info

logger.add_appenders \
    Logging.appenders.stdout,
    Logging.appenders.file('example.log')

logger.debug "this debug message will not be output by the logger"
logger.info "just some friendly advice"

The Logging library was created to allow each class in a program to have its own configurable logger. The logging level for a particular class can be changed independently of all other loggers in the system. This example shows the recommended way of accomplishing this.

require 'logging'

Logging.logger['FirstClass'].level = :warn
Logging.logger['SecondClass'].level = :debug

class FirstClass
  def initialize
    @logger = Logging.logger[self]
  end

  def some_method
    @logger.debug "some method was called on #{self.inspect}"
  end
end

class SecondClass
  def initialize
    @logger = Logging.logger[self]
  end

  def another_method
    @logger.debug "another method was called on #{self.inspect}"
  end
end

There are many more examples in the examples folder of the logging package. The recommended reading order is the following:

Extending

The Logging framework is extensible via the little-plugger gem based plugin system. New appenders or formatters can be released as ruby gems. When installed locally, the Logging framework will automatically detect these gems as plugins and make them available for use.

The logging-email plugin is a good example to follow. It includes a lib/logging/plugins/email.rb file which is detected by the plugin framework. This file declares a Logging::Plugins::Email.initialize_email method that is called when the plugin is loaded.

The three steps for creating a plugin are:

  • create a new Ruby gem: logging-<name>
  • include a plugin file: lib/logging/plugins/<name>.rb
  • definie a plugin initializer: Logging::Plugins::<Name>.initialize_<name>

Development

The Logging source code relies on the Mr Bones project for default rake tasks. You will need to install the Mr Bones gem if you want to build or test the logging gem. Conveniently there is a bootstrap script that you can run to setup your development environment.

script/bootstrap

This will install the Mr Bones gem and the required Ruby gems for development. After this is done you can rake rake -T to see the available rake tasks.

License

The MIT License - see the LICENSE file for the full text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].