Changeset 8d0941e9be7bff1c68d8452295990fdc72a0fe53

Show
Ignore:
Timestamp:
06/30/08 17:38:33 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1214847513 +0000
git-parent:

[f1321aca809330f906e8a5d508e18c0373566554]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1214847513 +0000
Message:

code reuse, pull this into utils, refs #26

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_check_log.c

    r5e653fe r8d0941e  
    1515 
    1616/* Log format is tab delimited: 
     17 * NOIT CONFIG (implemented in noit_conf.c): 
     18 *  'n' TIMESTAMP base64(gzip(xmlconfig)) 
    1719 * 
    1820 * CHECK: 
     
    2931static noit_log_stream_t status_log = NULL; 
    3032static noit_log_stream_t metrics_log = NULL; 
    31 #define SETUP_LOG(a) do { if(!a##_log) a##_log = noit_log_stream_find(#a); \ 
    32                           if(!a##_log) return; } while(0) 
    3333#define SECPART(a) ((unsigned long)(a)->tv_sec) 
    3434#define MSECPART(a) ((unsigned long)((a)->tv_usec / 1000)) 
     
    3737  struct timeval __now; 
    3838  char uuid_str[37]; 
    39   SETUP_LOG(check); 
     39  SETUP_LOG(check, return); 
    4040 
    4141  gettimeofday(&__now, NULL); 
     
    4949  char uuid_str[37]; 
    5050  stats_t *c; 
    51   SETUP_LOG(status); 
     51  SETUP_LOG(status, return); 
    5252 
    5353  uuid_unparse_lower(check->checkid, uuid_str); 
     
    6565  metric_t *m; 
    6666  stats_t *c; 
    67   SETUP_LOG(metrics); 
     67  SETUP_LOG(metrics, return); 
    6868 
    6969  uuid_unparse_lower(check->checkid, uuid_str); 
  • src/utils/noit_log.h

    r06f58e6 r8d0941e  
    7979} while(0) 
    8080 
     81#define SETUP_LOG(a, b) do { if(!a##_log) a##_log = noit_log_stream_find(#a); \ 
     82                             if(!a##_log) { b; } } while(0) 
     83 
    8184#endif