LateLog - Simple storage-based Log Library

Simple library to log to the storage, granting the possibility of viewing the log after the URL changes

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.greasyfork.org/scripts/461057/1156386/LateLog%20-%20Simple%20storage-based%20Log%20Library.js

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Δημιουργός
satology
Έκδοση
0.2
Δημιουργήθηκε την
02/03/2023
Ενημερώθηκε την
02/03/2023
Μέγεθος
5 KB
Άδεια
Μη διαθέσιμη

LateLog

Simple library created to store log messages, basic errors and JSON while using a crawler.

It adds a View log button to the script menu in TM that prints the stored messages to the console.

Basic usage

  1. Import the library using @require as stated above the script description

  2. Grant the following permissions to your script:

// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand

and then:


// Create a LateLog instance:
let late = new LateLog();

// Then just log using LateLog:
late.log('This will be stored');

Extended Example

You have access to 5 methods, so you can later view the messages in a similar way as when using console.log


late.log('Text saved as log');
late.info(`Date: ${new Date()}, as info`);
late.debug('Text saved as debug');
late.warn('Text saved as warning');
late.error('Text saved as error');

// Log a JSON stringifyable object
late.debug({ name: 'object log example' })

// Log an error using any level
try {
    let failme = something.that.fails;
} catch (err) {
    late.error(err);
    late.warn(err);
    late.info(err);
}

Customization

You can override some basic options when instantiating


let late = new LateLog({
    level: 5, // max level to store (from 1-log to 5-error)
    maxLines: 200, // max number of lines to store
    addTimestamp: true, // adds YY-MM-DD hh:mm:ss to the log
    printWhileLogging: false // prints new saved messages to console when storing
});