| 411 | |
| 412 | == Verbosity levels == |
| 413 | |
| 414 | === Current abstract concept === |
| 415 | |
| 416 | ||type || GRASS_VERBOSE || libgis || command line || result || libgis fn |
| 417 | ||verbose || 3 || MAX_LEVEL || --verbose || print progress and all messages messages || G_verbose_message() |
| 418 | ||standard || 2 || STD_LEVEL || || print progress and selected messages || G_message() |
| 419 | ||brief || 1 || || || print only progress information (% done) || G_percent(), G_clicker(), G_important_message() |
| 420 | ||quiet || 0 || MIN_LEVEL || --quiet || print nothing (only ERRORs and WARNINGs) || G_warning(), G_fatal_error() |
| 421 | ||debug || || 0-5 || || print debug message at DEBUG level set with g.gisenv || G_debug(#, "") |
| 422 | ||mute || - || || 2>&1 > /dev/null || only for use in rare occasions || |
| 423 | |
| 424 | ==== Proposal ==== |
| 425 | |
| 426 | * module output (should be "parsable") is not controlled by GRASS_VERBOSE [use fprintf (stdout, ...)] |
| 427 | * quiet[[BR]] |
| 428 | only warnings and fatal errors are printed |
| 429 | * brief [[BR]] |
| 430 | all G_percent() and G_important_message() (especially connected to progress information??) |
| 431 | * standard[[BR]] |
| 432 | all G_percent() and selected G_message() |
| 433 | * verbose[[BR]] |
| 434 | all G_percent() + G_message() + G_verbose_message() |
| 435 | |
| 436 | ==== Modification ==== |
| 437 | |
| 438 | * '''remove''' verbose level → standard == all G_percent () + G_messages()[[BR]] |
| 439 | why?? --HB |
| 440 | * remove "--verbose" from help pages, manually mention where it does work.[[BR]] |
| 441 | it only does something in a few modules |
| 442 | * move some messages to G_debug() |
| 443 | * move some messages to G_verbose_message() |
| 444 | * move some messages to G_important_message() |
| 445 | * change level numbers to 1, 3, 5 |
| 446 | * Add new G_msg(int level, "%format", ...); lib function. Existing G_message() could stay and would be the same as G_msg(LEVEL_STD,...). |
| 447 | |
| 448 | ==== Discussion ==== |
| 449 | |
| 450 | * HB: I'm quite happy to leave the current system as it is, but use GRASS_MESSAGE_FORMAT=silent to switch off G_percent(),G_clicker() output.[[BR]] |
| 451 | Mixing a sliding verbosity scale plus a binary switch or >= rule for when G_percent() happens in the same variable is very messy IMO. |
| 452 | |
| 453 | === Alternative Abstract concept === |
| 454 | |
| 455 | (Binary method, 3=1+2) |
| 456 | |
| 457 | ''How to deal with --verbose messages? add levels 4 (vmsg+msg) and 5(vmsg+msg+progress) ?'' |
| 458 | |
| 459 | ||standard || 3 || PERMSG_MODE || print progress and messages |
| 460 | ||standard || 2 || MESSAGE_MODE || print only messages |
| 461 | ||brief || 1 || PERCENT_MODE || print only progress information |
| 462 | ||silent but not mute || 0 || QUIET_MODE || print nothing (but ERR and WAR) |
| 463 | ||mute || 2>&1 > /dev/null || || |