- Timestamp:
- 01/25/2017 07:13:49 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/0-logger.php
r4595 r4785 11 11 * passing the data to this function, though. 12 12 * 13 * @todo add current username and request url to every entry, and update wp-cli command parsing regex to match14 13 * @todo add a $type param with 'error' and 'info' values. errors continue to go to std error log. info is logged 15 14 * to separate file, so they don't clutter error log. need to rotate that file. then update callers to use … … 22 21 $backtrace = debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, 2 ); 23 22 24 if ( $data && ! is_scalar( $data ) ) { 25 $data = (array) $data; 26 redact_keys( $data ); 27 $data = str_replace( "\n", '[newline]', wp_json_encode( $data ) ); 23 if ( 'cli' === php_sapi_name() ) { 24 $data['command'] = sprintf( '%s %s', $_SERVER['_'], implode( ' ', $_SERVER['argv'] ) ); 25 } else { 26 $data['request_url'] = sprintf( '%s://%s%s', $_SERVER['REQUEST_SCHEME'], $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI'] ); 27 28 // Fall back to IP address if it's too early to detect the user 29 if ( did_action( 'after_setup_theme' ) > 0 ) { 30 $data['current_user'] = get_current_user_id(); 31 } else { 32 $data['remote_ip'] = $_SERVER['REMOTE_ADDR']; 33 } 28 34 } 35 36 redact_keys( $data ); 37 $data = str_replace( "\n", '[newline]', wp_json_encode( $data ) ); 29 38 30 39 $log_entry = sprintf( … … 129 138 foreach ( $raw_entries as $entry ) { 130 139 $is_native_entry = 1 === preg_match( $native_entry_pattern, $entry, $entry_parts ); 140 // todo bug: this should be recognized as native -- [18-Jan-2017 00:33:04 UTC] [b1955769] source-site-id-setting.php:29 - preview:post_val -- [null] 131 141 132 142 if ( $is_native_entry ) {
Note: See TracChangeset
for help on using the changeset viewer.