예제 #1
0
파일: ui.c 프로젝트: charpty/goaccess
/* The entry point to render the overall statistics and free its data. */
void
display_general (WINDOW * win, GLog * glog, GHolder * h)
{
  GColors *(*colorlbl) (void) = color_overall_lbls;
  GColors *(*colorpth) (void) = color_overall_path;
  GColors *(*colorval) (void) = color_overall_vals;

  char *ifile = conf.ifile;
  size_t n, i;

  /* *INDENT-OFF* */
  Field fields[] = {
    {T_REQUESTS   , get_str_processed_reqs (glog)  , colorlbl , colorval , 0} ,
    {T_UNIQUE_VIS , get_str_visitors ()            , colorlbl , colorval , 0} ,
    {T_UNIQUE_FIL , get_str_reqs ()                , colorlbl , colorval , 0} ,
    {T_REFERRER   , get_str_ref_reqs ()            , colorlbl , colorval , 0} ,
    {T_VALID      , get_str_valid_reqs (glog)      , colorlbl , colorval , 0} ,
    {T_GEN_TIME   , get_str_proctime ()            , colorlbl , colorval , 0} ,
    {T_STATIC_FIL , get_str_static_reqs ()         , colorlbl , colorval , 0} ,
    {T_LOG        , get_str_filesize (glog, ifile) , colorlbl , colorval , 0} ,
    {T_FAILED     , get_str_failed_reqs (glog)     , colorlbl , colorval , 0} ,
    {T_EXCLUDE_IP , get_str_excluded_ips (glog)    , colorlbl , colorval , 0} ,
    {T_UNIQUE404  , get_str_notfound_reqs ()       , colorlbl , colorval , 0} ,
    {T_BW         , get_str_bandwidth (glog)       , colorlbl , colorval , 0} ,
    {T_LOG_PATH   , get_str_logfile (glog, ifile)  , colorlbl , colorpth , 1}
  };
  /* *INDENT-ON* */

  werase (win);
  render_overall_header (win, h);

  n = ARRAY_SIZE (fields);
  render_overall_statistics (win, fields, n);

  for (i = 0; i < n; i++) {
    free (fields[i].value);
  }
}
예제 #2
0
void
display_general (WINDOW * win, char *ifile, GLog * logger)
{
  GColors *(*colorlbl) (void) = color_overall_lbls;
  GColors *(*colorpth) (void) = color_overall_path;
  GColors *(*colorval) (void) = color_overall_vals;

  int col = getmaxx (stdscr);
  size_t n, i;

  /* *INDENT-OFF* */
  Field fields[] = {
    {T_REQUESTS   , get_str_processed_reqs (logger)  , colorlbl , colorval , 0},
    {T_UNIQUE_VIS , get_str_visitors ()              , colorlbl , colorval , 0},
    {T_UNIQUE_FIL , get_str_reqs ()                  , colorlbl , colorval , 0},
    {T_REFERRER   , get_str_ref_reqs ()              , colorlbl , colorval , 0},
    {T_VALID      , get_str_valid_reqs (logger)      , colorlbl , colorval , 0},
    {T_GEN_TIME   , get_str_proctime ()              , colorlbl , colorval , 0},
    {T_STATIC_FIL , get_str_static_reqs ()           , colorlbl , colorval , 0},
    {T_LOG        , get_str_filesize (logger, ifile) , colorlbl , colorval , 0},
    {T_FAILED     , get_str_failed_reqs (logger)     , colorlbl , colorval , 0},
    {T_EXCLUDE_IP , get_str_excluded_ips (logger)    , colorlbl , colorval , 0},
    {T_UNIQUE404  , get_str_notfound_reqs ()         , colorlbl , colorval , 0},
    {T_BW         , get_str_bandwidth (logger)       , colorlbl , colorval , 0},
    {T_LOG_PATH   , get_str_logfile (logger, ifile)  , colorlbl , colorpth , 1}
  };
  /* *INDENT-ON* */

  werase (win);
  draw_header (win, T_DASH " - " T_HEAD, " %s", 0, 0, col, color_panel_header);

  n = ARRAY_SIZE (fields);
  render_overall_statistics (win, fields, n);

  for (i = 0; i < n; i++) {
    free (fields[i].value);
  }
}