Coder Social home page Coder Social logo

sauron-goodies's Introduction

sauron-goodies

Goodies for the Sauron logger for emacs

Description

A collection of useful packages and functions for use with the Sauron logging system for emacs.

Packages

  • sauron-tail

    • tails a command or a file selectively logging events
    • filter functions accept a LINE and return:
      • t - insert the line
      • nil - don't insert the line
      • plist - insert a log message using the information in the plist
    • filter functions can customize log messages, add callbacks, or fire external events
    • helper functions to generate filters:
      • sauron-tail-match-p
      • sauron-tail-match
      • sauron-tail-highlight
  • sauron-mu4e

    • notify on email that is "interesting"
    • adds callback to open message in mu4e
    • formatter function available to custom log message
  • sauron-zeroconf

    • monitors zeroconf (avahi/bonjour) announcements and logs them to sauron
    • used to monitor network device availablity
    • add callback to open detailed information about the service
    • if there is a possible link to be made it will be added to the log
    • filter function can return t to log the event, nil to not log the event.

Examples

  • sauron-mu4e

    • Just load it!
     (require 'sauron-mu4e "path/to/sauron-mu4e.el")
     (add-to-list 'sauron-modules 'sauron-mu4e)
     (sauron-start)
    • optionally add your own formatter
     (defun my-formatter (msg)
     	...
     	logmsg)
     (setq sauron-mu4e-formatter-function #'my-formatter)
  • sauron-zeroconf

    • Just load it!
     (require 'sauron-mu4e "path/to/sauron-zeroconf.el")
     (add-to-list 'sauron-modules 'sauron-zeroconf)
     (sauron-start)
    • optionally add a filter
     (defun my-sauron-zeroconf-filter (process)
       (let ((host (zeroconf-service-host process))
     		(type (zeroconf-service-type process)))
     	(cond
     	  ;; The Apple TV is spammy
     	  ((string-match-p host "Apple-TV.local") nil)
     	  (t t))))
     (setq sauron-zeroconf-filter-function #'my-sauron-zeroconf-filter
  • sauron-tail

    • Load it, then tail it when to do
     (require 'sauron-tail "path/to/sauron-tail.el")
     (add-to-list 'sauron-modules 'sauron-tail)
     (sauron-start)
    • tail /var/log/messages
    (sauron-tail-file "/var/log/messages")
    • tail /var/log/messages giving a better prefix
    (sauron-tail-file "/var/log/messages" :prefix "messages")
    • tail /var/log/messages and only log lines matching "NetworkManager"
    (sauron-tail-file "/var/log/messages"
     				 :filter (sauron-tail-match-p "NetworkManager"))
    • tail the command journalctl, match lines matching NetworkManager, only printing the match
    (sauron-tail-command "journalctl -f"
     					:filter (sauron-tail-match "NetworkManager.*"))
    • tail the command journalctl, match lines matching NetworkManager, only printing adress
    (sauron-tail-command "journalctl -f"
     					:filter (sauron-tail-match "NetworkManager.*\\(address.*\\)"))
    • tail the command journalctl, match lines matching NetworkManager, highlighting the adress
    (sauron-tail-command "journalctl -f"
     					:filter (sauron-tail-highlight "NetworkManager.*\\(address.*\\)"))
    • tail the command journalctl, include all lines, and highlighting the adress
    (sauron-tail-command "journalctl -f"
     					:filter (sauron-tail-highlight "NetworkManager.*\\(address.*\\)")
     					:all)
    • tail the command journalctl, running a custom filter
    (sauron-tail-command "my-monitor"
                         :filter (lambda (line) (if (string-match "Error" line)
     					                       '(:prio 5 :msg "OH NO, AN ERROR")
     					                       '(:prio 4))))
    

sauron-goodies's People

Contributors

zallison avatar

Watchers

James Cloos 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.