Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

card-mod-logger

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

card-mod-logger

  • 0.3
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Logger mod (experimental)

This experimental mod has code in support of decko-friendly performance and request logging. It cannot boast the sophistication or support of modern logging tools, but there is enough clever code here to keep it around and hope that it some day may be useful, if for nothing else than for building richer integration with more established logging tools.

Performance logger

To enable logging add a performance_logger hash to your configuration.

Example:

 config.performance_logger = {
   min_time: 100,                 # show only method calls that are slower than 100ms
   max_depth: 3,                  # show nested method calls only up to depth 3
   details: true,                 # show method arguments and sql
   methods: [:event, :search, :fetch, :view],  # choose methods to log
   log_level: :info
 }

If you give :methods a hash you can log arbitrary methods. The syntax is as follows: class => method type => method name => log options

 Example:
   Card => {
     instance: [:fetch, :search],
     singleton: { fetch: { :title => 'Card.fetch' } },
     all: {
       fetch{
         message: 2,           # use second argument passed to fetch
         details: :to_s,       # use return value of to_s in method context
         title: proc { |method_context| method_context.name }
       },
     },
   }

class, method type and log options are optional.

Default values are Card, :all, and

  { title: method name, message: first argument, details: remaining arguments }

For example [:fetch] is equivalent to

  Card => { all: { fetch: { message: 1, details: 1..-1 } }

Request Logger

To use the request logger, set config.paths[request_log] to the path you want to log to, eg 'log/request.log'.

It should then begin producing a csv output.

FAQs

Package last updated on 17 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc