GithubHelp home page GithubHelp logo

clj-logbug's Introduction

logbug - Cross-cutting utils for logging and debugging in Clojure

Usage

Debug Wrappers

There are two wrapping functionalities:

  1. wrap calls to log invocation and results,
  2. wrap calls to remember (and later possibly re-apply) the last arguments.

Wrap Functions for Debug Logging

This functionality logs invocation and result of a function referenced by a var.

Example enable:

(debug/wrap-with-log-debug #'some-var)

Example log output:

[DEBUG some-ns clojure-agent-send-off-pool-5] [some-var "invoked" {:args ( ...
...
[DEBUG some-ns clojure-agent-send-off-pool-5] [some-var "returns" {:res ...

Example disable again:

(debug/unwrap-with-log-debug #'some-var)

Wrap Functions for Reapplying last Arguments

(debug/wrap-with-remember-last-argument #'some-var)

(debug/get-last-argument #'some-var)

(debug/re-apply-last-argument #'some-var)

Wrap a Complete Namespace

Example require the debug namespace:

(require ['drtom.logbug.debug :as 'debug])

Example wrap all vars in the current namespace:

(debug/debug-ns *ns*)

Example disable wrappers in the current namespace:

(debug/undebug-ns *ns*)

Notes

The use of require will "remove" existing wrappers. The last arguments are stored within the debug ns and thus they survive require etc.

License

Copyright © 2015 Thomas Schank

Distributed under the APGL.

clj-logbug's People

Contributors

drtom avatar

Watchers

James Cloos avatar Matus Kmit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.