Changeset 2591501
- Timestamp:
- 08/31/2021 01:05:15 PM (5 years ago)
- Location:
- ls-wp-logger/trunk
- Files:
-
- 3 added
- 1 deleted
- 4 edited
-
LS_WP_Logger.php (deleted)
-
Log.php (added)
-
README.md (modified) (1 diff)
-
images/banner-772x250.png (added)
-
images/icon-256x256.png (added)
-
js/main.js (modified) (5 diffs)
-
ls-wp-logger.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ls-wp-logger/trunk/README.md
r2438794 r2591501 1 1 # LS-WP-Logger 2 3 ## How to use 4 In any php file you can use methods: 5 6 ```php 7 Ls\Wp\Log::info("My Title", [any object]); 8 Ls\Wp\Log::error("My Title", [any object]); 9 ``` 10 11 or add namespace 12 13 ```php 14 use Ls\Wp\Log as Log; 15 16 Log::info("My Title", [any object]); 17 Log::error("My Title", [any object]); 18 ``` 19 20 ## Release Notes: 21 ### 2.0.0 22 Add `namespace` usage. \ 23 Add pritty view for `array` and `object` values -
ls-wp-logger/trunk/js/main.js
r2438794 r2591501 4 4 let logs = JSON.parse(lsWpAjax.logs); 5 5 let type = null; 6 let inDeleteProcess = false; 6 7 7 8 $('.sub-item').on('click', function(){ … … 14 15 $('#remove-button').on('click', ()=>{ 15 16 $('#ls-wp-logger-body').html('<div class="loading">Loading...</div>'); 17 inDeleteProcess = true; 16 18 $.post( lsWpAjax.url, { 17 19 action:'delete_logs', … … 19 21 }).done( data => { 20 22 logs = JSON.parse(data); 23 inDeleteProcess = false; 21 24 if(logs){ 22 25 updateTable(); … … 32 35 type: type 33 36 }).done( data => { 34 logs = JSON.parse(data); 35 if(logs){ 36 updateTable(); 37 if(!inDeleteProcess){ 38 logs = JSON.parse(data); 39 if(logs){ 40 updateTable(); 41 } 37 42 } 38 43 }); … … 57 62 58 63 const items = bodyItems.map((item, index) => { 64 const value = JSON.stringify(JSON.parse(item.value), null, '\t'); 59 65 return ` 60 66 <tr class="${index%2 ? '' : 'alternate'}"> 61 67 <td class="date column-date" 62 68 scope="row">${item.reg_date}</td> 63 <td class="column-columnname">${item.message}</td> 69 <td class="column-columnname"> 70 <b>${item.title}</b> 71 <pre>${value}</pre> 72 </td> 64 73 <td class="column-columnname">${item.type}</td> 65 74 </tr> -
ls-wp-logger/trunk/ls-wp-logger.php
r2438794 r2591501 4 4 Plugin URI: https://wordpress.org/plugins/ls-wp-logger 5 5 Description: This plugin stores logs for your application 6 Version: 1.0.06 Version: 2.0.0 7 7 Author: Lightning Soft 8 8 Author URI: https://lightning-soft.com/ … … 12 12 define('LS_WP_LOGGER_NAME', basename( __DIR__ )); 13 13 14 require __DIR__ . '/L S_WP_Logger.php';14 require __DIR__ . '/Log.php'; 15 15 16 if(class_exists('L S_WP_Logger')){16 if(class_exists('Ls\Wp\Log')){ 17 17 18 18 register_activation_hook( __FILE__, function() { 19 L S_WP_Logger::info('Plugin has activated');19 Ls\Wp\Log::info('Plugin has activated'); 20 20 }); 21 21 … … 33 33 34 34 add_action( 'wp_ajax_delete_logs', function () { 35 L S_WP_Logger::deleteLogs();36 $logs = L S_WP_Logger::getLogs(sanitize_text_field($_POST['type']));35 Ls\Wp\Log::deleteLogs(); 36 $logs = Ls\Wp\Log::getLogs(sanitize_text_field($_POST['type'])); 37 37 echo json_encode($logs); 38 38 wp_die(); … … 40 40 41 41 add_action( 'wp_ajax_get_logs', function () { 42 $logs = L S_WP_Logger::getLogs(sanitize_text_field($_POST['type']));42 $logs = Ls\Wp\Log::getLogs(sanitize_text_field($_POST['type'])); 43 43 echo json_encode($logs); 44 44 wp_die(); … … 52 52 array( 53 53 'url' => admin_url('admin-ajax.php'), 54 'logs' => json_encode(L S_WP_Logger::getLogs())54 'logs' => json_encode(Ls\Wp\Log::getLogs()) 55 55 ) 56 56 ); 57 57 } 58 58 } ); 59 60 59 } -
ls-wp-logger/trunk/readme.txt
r2438794 r2591501 3 3 Tags: log, logs, data logs 4 4 Requires at least: 5.4 5 Tested up to: 5. 66 Stable tag: 1.0.07 Requires PHP: 5.65 Tested up to: 5.8 6 Stable tag: 2.0.0 7 Requires PHP: 7.0 8 8 License: GPLv2 or later 9 9 … … 12 12 == Description == 13 13 14 This plugin stores logs for your application with different types: error and info14 This plugin stores logs for your application with different types: *error* and *info* 15 15 16 16 == Installation == … … 18 18 Upload the LS WP Logger plugin to your blog and activate it. 19 19 20 21 == How to use == 22 In any php file you can use methods: 23 24 ` 25 Ls\Wp\Log::info("My Title", [any object]); 26 Ls\Wp\Log::error("My Title", [any object]); 27 ` 28 29 or add namespace 30 31 ` 32 use Ls\Wp\Log as Log; 33 34 Log::info("My Title", [any object]); 35 Log::error("My Title", [any object]); 36 ` 37 38 20 39 == Changelog == 40 41 = 2.0.0 = 42 * 43 Add namespace usage. 44 Add pritty view for array and object values 45 * 21 46 22 47 = 1.0.0 =
Note: See TracChangeset
for help on using the changeset viewer.