Plugin Directory

Changeset 2591501


Ignore:
Timestamp:
08/31/2021 01:05:15 PM (5 years ago)
Author:
lightningsoft
Message:

Update namespace and update pritty view

Location:
ls-wp-logger/trunk
Files:
3 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • ls-wp-logger/trunk/README.md

    r2438794 r2591501  
    11# LS-WP-Logger
     2
     3## How to use
     4In any php file you can use methods:
     5
     6```php
     7Ls\Wp\Log::info("My Title", [any object]);
     8Ls\Wp\Log::error("My Title", [any object]);
     9```
     10
     11or add namespace
     12
     13```php
     14use Ls\Wp\Log as Log;
     15
     16Log::info("My Title", [any object]);
     17Log::error("My Title", [any object]);
     18```
     19
     20## Release Notes:
     21### 2.0.0
     22Add `namespace` usage. \
     23Add pritty view for `array` and `object` values
  • ls-wp-logger/trunk/js/main.js

    r2438794 r2591501  
    44        let logs = JSON.parse(lsWpAjax.logs);
    55        let type = null;
     6        let inDeleteProcess = false;
    67
    78        $('.sub-item').on('click', function(){
     
    1415        $('#remove-button').on('click', ()=>{
    1516            $('#ls-wp-logger-body').html('<div class="loading">Loading...</div>');
     17            inDeleteProcess = true;
    1618            $.post( lsWpAjax.url, {
    1719                action:'delete_logs',
     
    1921            }).done( data => {
    2022                logs = JSON.parse(data);
     23                inDeleteProcess = false;
    2124                if(logs){
    2225                    updateTable();
     
    3235                type: type
    3336            }).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                    }
    3742                }
    3843            });
     
    5762
    5863            const items = bodyItems.map((item, index) => {
     64                const value = JSON.stringify(JSON.parse(item.value), null, '\t');
    5965                return `
    6066                    <tr class="${index%2 ? '' : 'alternate'}">
    6167                        <td class="date column-date"
    6268                            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>
    6473                        <td class="column-columnname">${item.type}</td>
    6574                    </tr>
  • ls-wp-logger/trunk/ls-wp-logger.php

    r2438794 r2591501  
    44    Plugin URI: https://wordpress.org/plugins/ls-wp-logger
    55    Description: This plugin stores logs for your application
    6     Version: 1.0.0
     6    Version: 2.0.0
    77    Author: Lightning Soft 
    88    Author URI: https://lightning-soft.com/
     
    1212define('LS_WP_LOGGER_NAME', basename( __DIR__ ));
    1313
    14 require __DIR__ . '/LS_WP_Logger.php';
     14require __DIR__ . '/Log.php';
    1515
    16 if(class_exists('LS_WP_Logger')){
     16if(class_exists('Ls\Wp\Log')){
    1717
    1818    register_activation_hook( __FILE__, function() {
    19         LS_WP_Logger::info('Plugin has activated');
     19        Ls\Wp\Log::info('Plugin has activated');
    2020    });
    2121   
     
    3333   
    3434    add_action( 'wp_ajax_delete_logs', function () {
    35         LS_WP_Logger::deleteLogs();
    36         $logs = LS_WP_Logger::getLogs(sanitize_text_field($_POST['type']));
     35        Ls\Wp\Log::deleteLogs();
     36        $logs = Ls\Wp\Log::getLogs(sanitize_text_field($_POST['type']));
    3737        echo json_encode($logs);
    3838        wp_die();
     
    4040   
    4141    add_action( 'wp_ajax_get_logs', function () {
    42         $logs = LS_WP_Logger::getLogs(sanitize_text_field($_POST['type']));
     42        $logs = Ls\Wp\Log::getLogs(sanitize_text_field($_POST['type']));
    4343        echo json_encode($logs);
    4444        wp_die();
     
    5252                array(
    5353                    'url' => admin_url('admin-ajax.php'),
    54                     'logs' => json_encode(LS_WP_Logger::getLogs())
     54                    'logs' => json_encode(Ls\Wp\Log::getLogs())
    5555                )
    5656            ); 
    5757        }
    5858    } );
    59    
    6059}
  • ls-wp-logger/trunk/readme.txt

    r2438794 r2591501  
    33Tags: log, logs, data logs
    44Requires at least: 5.4
    5 Tested up to: 5.6
    6 Stable tag: 1.0.0
    7 Requires PHP: 5.6
     5Tested up to: 5.8
     6Stable tag: 2.0.0
     7Requires PHP: 7.0
    88License: GPLv2 or later
    99
     
    1212== Description ==
    1313
    14 This plugin stores logs for your application with different types: error and info
     14This plugin stores logs for your application with different types: *error* and *info*
    1515
    1616== Installation ==
     
    1818Upload the LS WP Logger plugin to your blog and activate it.
    1919
     20
     21== How to use ==
     22In any php file you can use methods:
     23
     24`
     25Ls\Wp\Log::info("My Title", [any object]);
     26Ls\Wp\Log::error("My Title", [any object]);
     27`
     28
     29or add namespace
     30
     31`
     32use Ls\Wp\Log as Log;
     33
     34Log::info("My Title", [any object]);
     35Log::error("My Title", [any object]);
     36`
     37
     38
    2039== Changelog ==
     40
     41= 2.0.0 =
     42*
     43Add namespace usage.
     44Add pritty view for array and object values
     45*
    2146
    2247= 1.0.0 =
Note: See TracChangeset for help on using the changeset viewer.