Introducing the job_log gem
Usage
require 'job_log'
jl = JobLog.new
jl.listen
The job_log gem subscribes to the following topics:
- log/+/started/+
- log/+/done/+
- log/+/aborted/+
Entries are save into the the Dynarex file job_log.xml.
Testing
require 'spspub_log'
sps = SPSPubLog.new host: 'sps2', port: 59100
sps.info 'frt/started: Fetches the remaining bank balance. #bank #balance'
sleep 3
sps.info 'frt/done: bye'
Output
file: job_log.xml
<?xml version='1.0' encoding='UTF-8'?> <jobs> <summary> <recordx_type>dynarex</recordx_type> <format_mask>[!title] [!desc] [!started] [!ended] [!status] [!tags]</format_mask> <schema>jobs/job(title, desc, started, ended, status, tags)</schema> <default_key>title</default_key> </summary> <records> <job id='1' created='2017-10-30 11:39:34 +0000' last_modified='2017-10-30 11:39:37 +0000'> <title>frt</title> <desc>Fetches the remaining bank balance.</desc> <started>2017-10-30 11:39:34 +0000</started> <ended>2017-10-30 11:39:37 +0000</ended> <status>success</status> <tags>bank balance</tags> </job> </records> </jobs>
Resources
joblog job_log gem job log spspublog sps