Changeset 3273 for sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wp-cli-commands/miscellaneous.php
- Timestamp:
- 05/30/2016 06:15:50 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wp-cli-commands/miscellaneous.php
r2419 r3273 90 90 } 91 91 } 92 93 /** 94 * Print a log with our custom entries formatted for humans 95 * 96 * ## OPTIONS 97 * 98 * <raw_log> 99 * : The raw log contents, or the filename of the raw log 100 * 101 * [--foreign=<action>] 102 * : Include foreign log entries from the output, or ignore them 103 * --- 104 * default: include 105 * options: 106 * - include 107 * - ignore 108 * --- 109 * 110 * ## EXAMPLES 111 * 112 * wp wc-misc format-log /var/log/php-errors.log 113 * wp wc-misc format-log "$(grep 'foo' /var/log/php-errors.log -A 10 -B 10)" |less -S 114 * wp wc-misc format-log "$(grep 'bar' /var/log/php-errors.log)" --foreign=ignore 115 * 116 * @subcommand format-log 117 * 118 * @param array $args 119 * @param array $assoc_args 120 */ 121 public function format_log( $args, $assoc_args ) { 122 list( $raw_log ) = $args; 123 124 if ( is_file( $raw_log ) ) { 125 $raw_log = file_get_contents( $raw_log ); 126 } 127 128 $formatted_log = \WordCamp\Logger\format_log( $raw_log, $assoc_args['foreign'] ); 129 130 WP_CLI::line( "\n" . $formatted_log ); 131 } 92 132 }
Note: See TracChangeset
for help on using the changeset viewer.