Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Console-SMP (Read 706 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Console-SMP


A helper script for Spider Monkey Panel and foobar2000 which allows to permanently save console logs to a file using the existing method (console.log). Helper meant mostly for coders not for final users, although it may be easily included on any script (don't expect how to's by my side apart from these instructions).

Default UI allows to open the console log into a panel and save its content to a file, but the option is reset on every start-up... thus defeating the idea of logging to a file. Since file logging may be useful on servers, specially when using headless installation and interacting with SMP scripts (to check response), this utility is offered as alternative.

Features
    -Saves any message send to the console on a text file (path configurable).
    -Saving is not reset on every start-up (contrary to Foobar2000's native console).
    -File is only reset when certain file size is reached (configurable).
    -Works 'as is' without any modification on existing scripts, just include it and done.
    -Converts sets and maps to arrays before logging.
    -Converts standard objects and functions as strings before logging.

Usage
Just include the helper file:
Code: [Select]
include('helpers\\helpers_xxx_console.js');
Since the original method has been wrapped, it will work without further modifications on an existing script:
Code: [Select]
console.log('This is output to log file at foobar profile folder and to console on UI.');
A new method has been created to only send the message to the the UI console:
Code: [Select]
console.logUI('This is output only to console on UI. New method.');
X

Other implementations
 1. Playlist-Tools-SMP: Different tools for foobar2000
 2. Playlist-Manager-SMP: A playlist manager for foobar2000.
 3. Any of my other scripts....

Installation
Since the addon only requires 1 file, i.e. the main helper, you can simply include it along any other script where you will use it.
X

Download latest release (or nightly releases) at github:

https://github.com/regorxxx/Console-SMP

Re: Console-SMP

Reply #1
https://github.com/regorxxx/Console-SMP/releases/tag/v1.0.1
Quote
New method console.popup to send at the same time the text to the console (For logging purpose) and show it in a popup. Lines are split before sending to console, so every line is sent in different calls (i.e. the date is shown on every line).

Re: Console-SMP

Reply #2
https://github.com/regorxxx/Console-SMP/releases/tag/v1.1.0
Quote
# [1.1.0] - 2022-06-05
### Added
- Rewrapped entire FbProfiler class to also log to file (the same than console.log). FbProfiler object has now an exposed property 'Name'. 'FbProfiler.Print' method will print to console and log file.
- New method 'FbProfiler.PrintUI' which mimics the old behavior, printing only to console.
### Changed
### Removed
### Fixed

## [1.0.3] - 2022-06-04
### Added
### Changed
- console.popup now has an additional argument to switch showing/hiding the popup (for ex. for actions via online controllers).
### Removed
### Fixed

## [1.0.2] - 2022-05-19
### Added
### Changed
- Check log file size before writing to file in the same session, not only on script loading.
### Removed
### Fixed
- Avoid file reading crashing in any case (even if it's locked by another process).

 

Re: Console-SMP

Reply #3
https://github.com/regorxxx/Console-SMP/releases/tag/v1.1.1

Quote
Quote
    # [1.1.1] - 2022-06-19
    ### Added
    - New setting 'conLogThrottling' to control the frequency of text writing to file. Consecutive calls within that interval are cached and all text flushed when there are no more calls (debouncing). This should greatly improve performance when calling the console multiple times in a small frame of time wring to physical file only once.