Check-in [b0feaa6955]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the log menu.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b0feaa6955ae9328a709b2d7b23f871a258b788768772b47481405eb7ef1a29e
User & Date: drh 2025-02-14 12:53:05.304
Context
2025-02-14
13:33
More improvements to the setup-logmenu page. check-in: 767509f617 user: drh tags: trunk
12:53
Improvements to the log menu. check-in: b0feaa6955 user: drh tags: trunk
2025-02-12
14:55
Slight simplification of [7f2b3a2d987a]. Works the same but with less code. check-in: 88d82553fc user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/setup.c.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    }
    db_protect_pop();
  }
}

/*
** Output a single entry for a menu generated using an HTML table.
** If zLink is not NULL or an empty string, then it is the page that
** the menu entry will hyperlink to.  If zLink is NULL or "", then
** the menu entry has no hyperlink - it is disabled.
*/
void setup_menu_entry(
  const char *zTitle,
  const char *zLink,
  const char *zDesc
){
  @ <tr><td valign="top" align="right">
  if( zLink && zLink[0] ){
    @ <a href="%s(zLink)"><nobr>%h(zTitle)</nobr></a>
  }else{
    @ %h(zTitle)
  }
  @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
}



/*
** WEBPAGE: setup
**







|






|





|

|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    }
    db_protect_pop();
  }
}

/*
** Output a single entry for a menu generated using an HTML table.
** If zLink is neither NULL nor an empty string, then it is the page that
** the menu entry will hyperlink to.  If zLink is NULL or "", then
** the menu entry has no hyperlink - it is disabled.
*/
void setup_menu_entry(
  const char *zTitle,
  const char *zLink,
  const char *zDesc  /* Caution!  Rendered using %s.  May contain raw HTML. */
){
  @ <tr><td valign="top" align="right">
  if( zLink && zLink[0] ){
    @ <a href="%s(zLink)"><nobr>%h(zTitle)</nobr></a>
  }else{
    @ <nobr>%h(zTitle)</nobr>
  }
  @ </td><td width="5"></td><td valign="top">%s(zDesc)</td></tr>
}



/*
** WEBPAGE: setup
**
188
189
190
191
192
193
194

195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214




215
216
217
218
219
220
221
222















223
224
225

226
227
228
229






230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
** Show a menu of available log renderings accessible to an administrator, 
** together with a succinct explanation of each.
**
** This page is only accessible by administrators.
*/
void setup_logmenu_page(void){
  Blob desc;

  blob_init(&desc, 0, 0);

  /* Administrator access only */
  login_check_credentials();
  if( !g.perm.Admin ){
    login_needed(0);
    return;
  }
  style_header("Log Menu");
  @ <table border="0" cellspacing="3">
  setup_menu_entry("Admin Log", "admin_log",
    "The admin log records configuration changes to the repository.\n"
    "The admin log is stored in the \"admin_log\" table of the repository.\n"
  );
  setup_menu_entry("Artifact Log", "rcvfromlist",
    "The artifact log records when new content is added to the repository.\n"
    "The time and date and origin of the new content is entered into the\n"
    "Log.  The artifact log is always on and is stored in the \"rcvfrom\"\n"
    "table of the repository.\n"
  );





  blob_appendf(&desc,
    "The error log is a separate text file to which warning and error\n"
    "messages are appended.  A single error log can and often is shared\n"
    "across multiple repositories.\n"
  );
  if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
    blob_appendf(&desc,"The error log is disabled for this repository.");















  }else{
    blob_appendf(&desc,"In this repository, the error log is in the file"
       "named \"%s\".", g.zErrlog);

  }
  setup_menu_entry("Error Log", "errorlog", blob_str(&desc));
  blob_reset(&desc);







  setup_menu_entry("Panic Log", "paniclog",
    "The panic log is a filtering of the Error Log that shows only the\n"
    "most important messages - assertion faults, segmentation faults, and\n"
    "similar malfunctions."
  );

  setup_menu_entry("User Log", "user_log",
    "The user log is a record of login attempts.  The user log is stored\n"
    "in the \"accesslog\" table of the respository.\n"
  );

  setup_menu_entry("Hack Log", "hacklog",
    "All 418 hack attempts"
  );

  setup_menu_entry("Non-Hack Log", "hacklog?not",
    "All log messages that are not hack attempts"
  );


  @ </table>
  style_finish_page();
}

/*
** Generate a checkbox for an attribute.







>




















>
>
>
>







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>

|


>
>
>
>
>
>
|
<
|
|


<
<
<
<

|
|


|
|

<







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

258
259
260
261




262
263
264
265
266
267
268
269

270
271
272
273
274
275
276
** Show a menu of available log renderings accessible to an administrator, 
** together with a succinct explanation of each.
**
** This page is only accessible by administrators.
*/
void setup_logmenu_page(void){
  Blob desc;
  int bErrLog;                 /* True if Error Log enabled */
  blob_init(&desc, 0, 0);

  /* Administrator access only */
  login_check_credentials();
  if( !g.perm.Admin ){
    login_needed(0);
    return;
  }
  style_header("Log Menu");
  @ <table border="0" cellspacing="3">
  setup_menu_entry("Admin Log", "admin_log",
    "The admin log records configuration changes to the repository.\n"
    "The admin log is stored in the \"admin_log\" table of the repository.\n"
  );
  setup_menu_entry("Artifact Log", "rcvfromlist",
    "The artifact log records when new content is added to the repository.\n"
    "The time and date and origin of the new content is entered into the\n"
    "Log.  The artifact log is always on and is stored in the \"rcvfrom\"\n"
    "table of the repository.\n"
  );
  setup_menu_entry("User Log", "user_log",
    "The user log is a record of login attempts.  The user log is stored\n"
    "in the \"accesslog\" table of the respository.\n"
  );

  blob_appendf(&desc,
    "The error log is a separate text file to which warning and error\n"
    "messages are appended.  A single error log can and often is shared\n"
    "across multiple repositories.\n"
  );
  if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
    blob_appendf(&desc,"The error log is disabled. "
                       "To activate the error log ");
    if( fossil_strcmp(g.zCmdName, "cgi")==0 ){
      blob_appendf(&desc,
        "make an entry like \"errorlog: <i>FILENAME</i>\""
        " in the CGI script at %h",
        P("SCRIPT_FILENAME")
      );
    }else{
      blob_appendf(&desc,
        " add the \"--errorlog <i>FILENAME</i>\" option to the"
        "\"%h %h\" command that launched this server.",
        g.argv[0], g.zCmdName
      );
    }
    bErrLog = 0;
  }else{
    blob_appendf(&desc,"In this repository, the error log is in the file"
       "named \"%s\".", g.zErrlog);
    bErrLog = 1;
  }
  setup_menu_entry("Error Log", bErrLog ? "errorlog" : 0, blob_str(&desc));
  blob_reset(&desc);

  @ <tr><td><td><td>
  @ &mdash;&mdash;
  @ <i>The remaining links are subsets of the Error Log</i>
  @ &mdash;&mdash;
  @ </td>  

  setup_menu_entry("Panic Log", bErrLog ? "paniclog" : 0,

    "Only the most important messages in the Error Log:\n"
    "assertion faults, segmentation faults, and similar malfunctions.\n"
  );






  setup_menu_entry("Hack Log", bErrLog ? "hacklog" : 0,
    "All code-418 hack attempts in the Error Log"
  );

  setup_menu_entry("Non-Hack Log", bErrLog ? "hacklog?not" : 0,
    "All log messages that are not code-418 hack attempts"
  );


  @ </table>
  style_finish_page();
}

/*
** Generate a checkbox for an attribute.