### Install LogViewer Package with Composer Source: https://github.com/arcanedev/logviewer/wiki/2.-Installation-and-Setup Installs the LogViewer package using Composer. You can either run the direct command or add the package to your composer.json file and then run composer install or update. ```bash composer require "arcanedev/log-viewer":"~3.0" ``` ```json { "require": { "arcanedev/log-viewer": "~3.0" } } ``` -------------------------------- ### Install Arcanedev LogViewer with Composer Source: https://github.com/arcanedev/logviewer/blob/master/_docs/1.Installation-and-Setup.md Installs the Arcanedev LogViewer package using Composer. Ensure you select a version compatible with your Laravel version. For example, version ~4.6.0 is compatible with Laravel v5.7. ```bash composer require arcanedev/log-viewer:{x.x} ``` -------------------------------- ### Check LogViewer Application Requirements and Log Files Source: https://github.com/arcanedev/logviewer/wiki/2.-Installation-and-Setup Runs a check for the LogViewer package's application requirements and log files. This command helps ensure that the environment is properly set up for the LogViewer to function. ```bash php artisan log-viewer:check ``` -------------------------------- ### Register LogViewer Service Provider in Laravel Source: https://github.com/arcanedev/logviewer/wiki/2.-Installation-and-Setup Registers the LogViewer service provider in the `config/app.php` file within the `providers` array. This step is necessary for the package to function correctly within a Laravel application. ```php 'providers' => [ ... Arcanedev\LogViewer\LogViewerServiceProvider::class, // for PHP 5.4 (Or the ugly way) : // 'Arcanedev\LogViewer\LogViewerServiceProvider' ] ``` -------------------------------- ### Publish LogViewer Configuration and Translations Source: https://github.com/arcanedev/logviewer/wiki/2.-Installation-and-Setup Publishes the configuration and translation files for the LogViewer package. The `--force` flag can be used to overwrite existing files. Specific tags like 'config' or 'translations' can be used to publish only one type of file. ```bash php artisan log-viewer:publish ``` ```bash php artisan log-viewer:publish --force ``` ```bash php artisan log-viewer:publish --tag=config ``` ```bash php artisan log-viewer:publish --tag=translations ``` -------------------------------- ### Publish LogViewer Assets with Artisan Source: https://github.com/arcanedev/logviewer/blob/master/_docs/1.Installation-and-Setup.md Publishes the configuration and translation files for the LogViewer package. The `--force` flag can be used to overwrite existing files. Specific tags like 'config' or 'translations' can be used to publish only certain assets. ```bash php artisan log-viewer:publish ``` ```bash php artisan log-viewer:publish --force ``` ```bash php artisan log-viewer:publish --tag=config ``` ```bash php artisan log-viewer:publish --tag=translations ``` -------------------------------- ### Configure Laravel .env for Daily Log Channel Source: https://github.com/arcanedev/logviewer/blob/master/_docs/1.Installation-and-Setup.md Ensures LogViewer functions correctly by setting the Laravel log channel to 'daily'. This is a prerequisite for LogViewer's operation. It requires modifying the .env file. ```env APP_LOG=daily ``` -------------------------------- ### Clear LogViewer Log Files with Artisan Source: https://github.com/arcanedev/logviewer/blob/master/_docs/1.Installation-and-Setup.md Clears all generated log files managed by the LogViewer package. Use this command with caution as it will permanently delete log files. ```bash php artisan log-viewer:clear ``` -------------------------------- ### Register LogViewer Service Provider in Laravel Source: https://github.com/arcanedev/logviewer/blob/master/_docs/1.Installation-and-Setup.md Registers the Arcanedev LogViewer service provider in the `config/app.php` file. This step is usually automatic for Laravel versions 5.5 and above. No facade registration is needed as it's handled automatically. ```php 'providers' => [ ... Arcanedev\LogViewer\LogViewerServiceProvider::class, ], ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/arcanedev/logviewer/blob/master/CONTRIBUTING.md Installs all project dependencies using Composer. This is a prerequisite for running tests and contributing to the project. ```bash composer install ``` -------------------------------- ### LogViewer::version() - Get LogViewer Version Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves the currently installed version of the LogViewer package. ```APIDOC ## LogViewer::version() ### Description Retrieves the currently installed version of the LogViewer package. ### Method GET ### Endpoint /version ### Parameters None #### Request Body None ### Request Example ```php $version = LogViewer::version(); // or $version = log_viewer()->version(); echo "LogViewer Version: " . $version; ``` ### Response #### Success Response (200) - **version** (string) - The version string of the LogViewer package (e.g., "1.2.3"). #### Response Example ```json { "version": "1.2.3" } ``` ``` -------------------------------- ### LogViewer::all() - Get All Logs Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves all log entries. The specific return format needs to be detailed. ```APIDOC ## LogViewer::all() ### Description Retrieves all log entries. The specific return format needs to be detailed. ### Method GET ### Endpoint /logs ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php $logs = LogViewer::all(); ``` ### Response #### Success Response (200) - **logs** (LogCollection) - A collection of all log entries. #### Response Example ```json { "logs": [ // Log entries ] } ``` ``` -------------------------------- ### LogViewer::menu() - Get Log Menu Structure Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves a menu structure for navigating log data. ```APIDOC ## LogViewer::menu($trans = true) ### Description Retrieves a menu structure for navigating log data. ### Method GET ### Endpoint /logs/menu ### Parameters #### Path Parameters None #### Query Parameters - **trans** (bool) - Optional - Whether to use translated names. Defaults to true. #### Request Body None ### Request Example ```php $logMenu = LogViewer::menu(false); ``` ### Response #### Success Response (200) - **menu** (array) - An array representing the log navigation menu. #### Response Example ```json { "menu": [ // Menu structure for logs ] } ``` ``` -------------------------------- ### LogViewer::files() - Get List of Log Files Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array containing the full paths of all available log files. ```APIDOC ## LogViewer::files() ### Description Returns an array containing the full paths of all available log files. ### Method GET ### Endpoint /logs/files ### Parameters None #### Request Body None ### Request Example ```php $files = LogViewer::files(); print_r($files); ``` ### Response #### Success Response (200) - **files** (array) - An array of strings, where each string is the full path to a log file. #### Response Example ```json { "files": [ "/path/to/storage/logs/laravel-2023-10-01.log", "/path/to/storage/logs/laravel-2023-10-02.log" ] } ``` ``` -------------------------------- ### Run PHPUnit Tests Source: https://github.com/arcanedev/logviewer/blob/master/CONTRIBUTING.md Executes the project's test suite using PHPUnit. Ensures that all tests pass before submitting a pull request. Assumes Composer dependencies have been installed. ```bash vendor/bin/phpunit ``` -------------------------------- ### LogViewer::get() - Get Log by Date Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves a specific log file by its date. ```APIDOC ## LogViewer::get($date) ### Description Retrieves a specific log file by its date. ### Method GET ### Endpoint /logs/{date} ### Parameters #### Path Parameters - **date** (string) - Required - The date of the log file to retrieve. Format: YYYY-MM-DD. #### Query Parameters None #### Request Body None ### Request Example ```php $log = LogViewer::get('2023-10-27'); ``` ### Response #### Success Response (200) - **log** (Log) - The log object for the specified date. #### Response Example ```json { "date": "2023-10-27", "entries": [ // Log entries for the date ] } ``` ``` -------------------------------- ### LogViewer::levels() - Get PSR-3 Log Levels Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array of all standard PSR-3 log levels. ```APIDOC ## LogViewer::levels() ### Description Returns an array of all standard PSR-3 log levels. ### Method GET ### Endpoint /logs/levels ### Parameters None #### Request Body None ### Request Example ```php $levels = LogViewer::levels(); print_r($levels); ``` ### Response #### Success Response (200) - **levels** (array) - An associative array where keys are uppercase log level names and values are their lowercase equivalents. #### Response Example ```json { "levels": { "EMERGENCY": "emergency", "ALERT": "alert", "CRITICAL": "critical", "ERROR": "error", "WARNING": "warning", "NOTICE": "notice", "INFO": "info", "DEBUG": "debug" } } ``` ``` -------------------------------- ### LogViewer::tree() - Get Log Tree Structure Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves a hierarchical representation of log data. ```APIDOC ## LogViewer::tree($trans = false) ### Description Retrieves a hierarchical representation of log data. ### Method GET ### Endpoint /logs/tree ### Parameters #### Path Parameters None #### Query Parameters - **trans** (bool) - Optional - Whether to use translated names. Defaults to false. #### Request Body None ### Request Example ```php $logTree = LogViewer::tree(true); ``` ### Response #### Success Response (200) - **tree** (array) - A nested array representing the log structure. #### Response Example ```json { "tree": [ // Tree structure of logs ] } ``` ``` -------------------------------- ### LogViewer::entries() - Get Log Entries by Date and Level Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves log entries for a specific date, optionally filtered by log level. ```APIDOC ## LogViewer::entries($date, $level = 'all') ### Description Retrieves log entries for a specific date, optionally filtered by log level. ### Method GET ### Endpoint /logs/{date}/entries ### Parameters #### Path Parameters - **date** (string) - Required - The date of the log entries to retrieve. Format: YYYY-MM-DD. #### Query Parameters - **level** (string) - Optional - The log level to filter by (e.g., 'error', 'info'). Defaults to 'all'. #### Request Body None ### Request Example ```php $entries = LogViewer::entries('2023-10-27', 'error'); ``` ### Response #### Success Response (200) - **entries** (LogEntryCollection) - A collection of log entries matching the criteria. #### Response Example ```json { "entries": [ // Log entries for the specified date and level ] } ``` ``` -------------------------------- ### Get List of Log Files - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array containing the full paths of all available log files. This helps in programmatically accessing log file locations. ```php /** * LogViewer::files() * * @return array */ $files = LogViewer::files(); var_dump($files); /* array( 0 => "{BASE_PATH}\storage\logs\laravel-2015-04-01.log" 1 => "{BASE_PATH}\storage\logs\laravel-2015-05-01.log" 2 => "{BASE_PATH}\storage\logs\laravel-2015-06-01.log" ... ) */ ``` -------------------------------- ### Get Total Log Entries - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns the total count of all log entries across all files. Can be filtered by a specific log level to get a count for errors, warnings, etc. ```php /** * LogViewer::total($level) * * @param string|null $level - Log level if you want to filter the entries * * @return int */ $total = LogViewer::total(); // or LogViewer::total('all') var_dump($total); // >= 0 // To filter by level $total = LogViewer::total('error'); var_dump($total); // >= 0 ``` -------------------------------- ### LogViewer::dates() - Get List of Log Dates Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array containing the dates for which log files exist. ```APIDOC ## LogViewer::dates() ### Description Returns an array containing the dates for which log files exist. ### Method GET ### Endpoint /logs/dates ### Parameters None #### Request Body None ### Request Example ```php $dates = LogViewer::dates(); print_r($dates); ``` ### Response #### Success Response (200) - **dates** (array) - An array of strings, where each string represents a date in YYYY-MM-DD format. #### Response Example ```json { "dates": [ "2023-10-02", "2023-10-01" ] } ``` ``` -------------------------------- ### Get All Logs - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves all log entries. Returns a LogCollection object. This is a core function for accessing log data. ```php /** * LogViewer::all() * * @return Arcanedev\LogViewer\Entities\LogCollection */ ``` -------------------------------- ### Get Log Levels - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array of all available log levels according to the PSR-3 standard. This is useful for understanding the types of log messages. ```php /** * LogViewer::levels() * * @return array */ $levels = LogViewer::levels(); var_dump($levels); /* array( "EMERGENCY" => "emergency" "ALERT" => "alert" "CRITICAL" => "critical" "ERROR" => "error" "WARNING" => "warning" "NOTICE" => "notice" "INFO" => "info" "DEBUG" => "debug" ) */ ``` -------------------------------- ### Get LogViewer Version - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves the current version string of the LogViewer package. Can be accessed directly or via a helper function. Provides version information for compatibility checks. ```php /** * LogViewer::version() * * @return string */ $version = LogViewer::version(); // or log_viewer()->version() echo $version; // x.x.x ``` -------------------------------- ### LogViewer::levelsNames() - Get Translated Log Level Names Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array of translated log level names, optionally for a specific locale. ```APIDOC ## LogViewer::levelsNames($locale = null) ### Description Returns an array of translated log level names, optionally for a specific locale. ### Method GET ### Endpoint /logs/levels/names ### Parameters #### Path Parameters None #### Query Parameters - **locale** (string) - Optional - The locale for which to translate the level names (e.g., 'en', 'fr'). If null, the application's default locale is used. #### Request Body None ### Request Example ```php // Get translated names using the default locale $translatedLevels = LogViewer::levelsNames(); // Get translated names for French $frenchLevels = LogViewer::levelsNames('fr'); ``` ### Response #### Success Response (200) - **levels** (array) - An associative array where keys are lowercase log level names and values are their translated display names. #### Response Example ```json { "levels": { "emergency": "Urgence", "alert": "Alerte", "critical": "Critique", "error": "Erreur", "warning": "Avertissement", "notice": "Notice", "info": "Info", "debug": "Debug" } } ``` ``` -------------------------------- ### Get Log Entries by Date and Level - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves log entries for a specific date, optionally filtered by log level. The date format is 'YYYY-MM-DD'. Returns a LogEntryCollection. ```php /** * LogViewer::entries($date, $level = 'all') * * @param string $date - Format : YYYY-MM-DD * @param string $level * * @return Arcanedev\LogViewer\Entities\LogEntryCollection */ ``` -------------------------------- ### Get Specific Log by Date - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Retrieves a specific log file for a given date. The date must be in 'YYYY-MM-DD' format. Returns a Log object representing the specified day's logs. ```php /** * LogViewer::get($date) * * @param string $date - Format : YYYY-MM-DD * * @return Arcanedev\LogViewer\Entities\Log */ ``` -------------------------------- ### Get List of Log Dates - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array of dates for which log files exist, formatted as 'YYYY-MM-DD'. This is useful for filtering or displaying available log data by date. ```php /** * LogViewer::dates() * * @return array */ $dates = LogViewer::dates(); var_dump($dates); /* array( 0 => "2015-06-01" 1 => "2015-05-01" 2 => "2015-04-01" ... ) */ ``` -------------------------------- ### Get Translated Log Level Names - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns an array of translated log level names. Optionally accepts a locale string to specify the language for translation. Defaults to the application's locale. ```php /** * LogViewer::levelsNames($locale) * * @param string|null $locale * * @return array */ $levels = LogViewer::levelsNames(); // or LogViewer::levelsNames('auto') var_dump($levels); /* If the 'app.locale' == 'en' then the result would be : array ( "emergency" => "Emergency" "alert" => "Alert" "critical" => "Critical" "error" => "Error" "warning" => "Warning" "notice" => "Notice" "info" => "Info" "debug" => "Debug" ) */ ``` ```php /** * LogViewer::levelsNames($locale) * * @param string|null $locale * * @return array */ $levels = LogViewer::levelsNames('fr'); var_dump($levels); /* array( "emergency" => "Urgence" "alert" => "Alerte" "critical" => "Critique" "error" => "Erreur" "warning" => "Avertissement" "notice" => "Notice" "info" => "Info" "debug" => "Debug" ) */ ``` -------------------------------- ### Configure Download Settings - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Defines settings related to downloading log files. This includes specifying a prefix and extension for the downloaded log files, ensuring consistency with the configured log file pattern. ```php [ 'prefix' => 'laravel-', 'extension' => 'log', ], // ... ]; ``` -------------------------------- ### Configure Log File Pattern - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Defines the naming convention for log files. This includes setting a prefix, a date format, and an extension, ensuring the LogViewer can correctly identify and parse log files. It utilizes predefined constants for pattern components. ```php [ 'prefix' => Filesystem::PATTERN_PREFIX, // 'laravel-' 'date' => Filesystem::PATTERN_DATE, // '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' 'extension' => Filesystem::PATTERN_EXTENSION, // '.log' ], // ... ]; ``` -------------------------------- ### Configure Route Middleware via .env - Bash Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Demonstrates how to configure middleware for the LogViewer route using the .env file. This allows for flexible access control by specifying middleware as comma-separated values. ```bash # Example 1: single middleware ARCANEDEV_LOGVIEWER_MIDDLEWARE=web ``` ```bash # Example 2: multiple middlewares ARCANEDEV_LOGVIEWER_MIDDLEWARE=web,auth,custom-middleware ``` -------------------------------- ### Configure Log File Download Settings (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Sets the prefix and extension for downloaded log files. This allows for customization of the naming convention when users download log files through the LogViewer interface. ```php [ 'prefix' => 'laravel-', 'extension' => 'log', ], ... ]; ``` -------------------------------- ### Configure Theme - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Sets the visual theme for the LogViewer interface. It supports predefined themes like 'bootstrap-3' and 'bootstrap-4', and allows for custom themes by adding folders to the views directory. This controls the overall look and feel of the application. ```php 'bootstrap-4', // ... ]; ``` -------------------------------- ### Configure Route Settings - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Manages the routing for the LogViewer. This includes enabling the route, defining a URL prefix, and specifying middleware for access control. Environment variables can be used to dynamically set middleware. ```php [ 'enabled' => true, 'attributes' => [ 'prefix' => 'log-viewer', 'middleware' => env('ARCANEDEV_LOGVIEWER_MIDDLEWARE') ? explode(',', env('ARCANEDEV_LOGVIEWER_MIDDLEWARE')) : null, ], 'show' => 'log-viewer::logs.show', ], // ... ]; ``` -------------------------------- ### Download Log File - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Provides a downloadable response for a specific log file. Allows specifying a filename and custom headers. Returns a BinaryFileResponse. ```php /** * LogViewer::download($date, $filename = null, $headers = []) * * @param string $date * @param string|null $filename * @param array $headers * * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ ``` -------------------------------- ### LogViewer::download() - Download Log File Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Downloads a specific log file. You can optionally specify a filename and custom headers. ```APIDOC ## LogViewer::download($date, $filename = null, $headers = []) ### Description Downloads a specific log file. You can optionally specify a filename and custom headers. ### Method GET ### Endpoint /logs/{date}/download ### Parameters #### Path Parameters - **date** (string) - Required - The date of the log file to download. Format: YYYY-MM-DD. #### Query Parameters - **filename** (string) - Optional - The desired name for the downloaded file. - **headers** (array) - Optional - An array of custom HTTP headers to include with the download response. #### Request Body None ### Request Example ```php // Download log for a specific date $response = LogViewer::download('2023-10-27'); // Download with a custom filename $response = LogViewer::download('2023-10-27', 'my-custom-log.log'); ``` ### Response #### Success Response (200) - **fileResponse** (BinaryFileResponse) - A Symfony BinaryFileResponse object that initiates the file download. #### Response Example (This will trigger a file download, so a JSON example is not directly applicable. The response headers will indicate the file content.) ``` -------------------------------- ### Define Stack Trace Highlight Strings in PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md This PHP configuration specifies an array of regular expression strings intended for highlighting within stack trace outputs. These patterns, such as '#\d+' for line numbers and 'Stack trace:', help to visually emphasize key parts of error logs. ```php [ '^#\d+', '^Stack trace:', ], ]; ``` -------------------------------- ### Generate Log Menu Structure - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Generates a menu structure from log data. Can optionally include translations. Useful for navigation or reporting purposes. ```php /** * LogViewer::menu($trans = true) * * @param bool|true $trans * * @return array */ ``` -------------------------------- ### Configure LogViewer Route Settings (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Enables and configures the route for accessing the LogViewer interface. This includes setting a custom URL prefix and optionally defining middleware for access control. The route is enabled by default. ```php [ 'enabled' => true, 'attributes' => [ 'prefix' => 'log-viewer', 'middleware' => null, ], ], ... ]; ``` -------------------------------- ### Define Log Icons in PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md This PHP snippet defines an array of icons, primarily using Font Awesome classes, to visually represent different log levels such as 'emergency', 'alert', 'error', and 'debug'. It maps descriptive keys to corresponding icon class strings. ```php [ /** * Font awesome >= 4.3 * http://fontawesome.io/icons/ */ 'all' => 'fa fa-fw fa-list', 'emergency' => 'fa fa-fw fa-bug', 'alert' => 'fa fa-fw fa-bullhorn', 'critical' => 'fa fa-fw fa-heartbeat', 'error' => 'fa fa-fw fa-times-circle', 'warning' => 'fa fa-fw fa-exclamation-triangle', 'notice' => 'fa fa-fw fa-exclamation-circle', 'info' => 'fa fa-fw fa-info-circle', 'debug' => 'fa fa-fw fa-life-ring', ], // ... ]; ``` -------------------------------- ### Set Log Entries Per Page in LogViewer (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Defines the number of log entries to display on each page within the LogViewer interface. This setting helps control the density of information presented to the user. ```php 30, ... ]; ``` -------------------------------- ### Paginate Logs - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns a paginated collection of all log entries. Allows for controlled display of logs, defaulting to 30 entries per page. Useful for large log files. ```php /** * LogViewer::paginate($perPage = 30) * * @param int $perPage * * @return Arcanedev\LogViewer\Entities\LogCollection */ ``` -------------------------------- ### Map Log Levels to Icons in LogViewer (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Assigns Font Awesome icons to different log levels. This configuration allows for visual differentiation of log entries based on their severity within the LogViewer interface. ```php [ /** * Font awesome >= 4.3 * http://fontawesome.io/icons/ */ 'all' => 'fa fa-fw fa-list', // http://fontawesome.io/icon/list/ 'emergency' => 'fa fa-fw fa-bug', // http://fontawesome.io/icon/bug/ 'alert' => 'fa fa-fw fa-bullhorn', // http://fontawesome.io/icon/bullhorn/ 'critical' => 'fa fa-fw fa-heartbeat', // http://fontawesome.io/icon/heartbeat/ 'error' => 'fa fa-fw fa-times-circle', // http://fontawesome.io/icon/times-circle/ 'warning' => 'fa fa-fw fa-exclamation-triangle', // http://fontawesome.io/icon/exclamation-triangle/ 'notice' => 'fa fa-fw fa-exclamation-circle', // http://fontawesome.io/icon/exclamation-circle/ 'info' => 'fa fa-fw fa-info-circle', // http://fontawesome.io/icon/info-circle/ 'debug' => 'fa fa-fw fa-life-ring', // http://fontawesome.io/icon/life-ring/ ], ... ]; ``` -------------------------------- ### Define LogViewer Facade Alias (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Specifies the facade accessor name for LogViewer. This allows for convenient access to LogViewer's functionality through a static facade, simplifying its usage within the application. ```php 'LogViewer', ... ]; ``` -------------------------------- ### LogViewer::paginate() - Paginate Logs Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns a paginator object for all logs, allowing for paginated retrieval. ```APIDOC ## LogViewer::paginate($perPage = 30) ### Description Returns a paginator object for all logs, allowing for paginated retrieval. ### Method GET ### Endpoint /logs/paginate ### Parameters #### Path Parameters None #### Query Parameters - **perPage** (int) - Optional - The number of logs to display per page. Defaults to 30. #### Request Body None ### Request Example ```php $paginatedLogs = LogViewer::paginate(50); ``` ### Response #### Success Response (200) - **paginatedLogs** (Paginator) - A paginator object containing log entries. #### Response Example ```json { "current_page": 1, "data": [ // Log entries for the current page ], "first_page_url": "...", "from": 1, "last_page": 10, "last_page_url": "...", "next_page_url": "...", "path": "...", "per_page": 30, "prev_page_url": null, "to": 30, "total": 300 } ``` ``` -------------------------------- ### Configure Menu Settings - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Customizes the menu options within the LogViewer. This includes setting the route for filtering logs and enabling or disabling icons in the menu, providing a more tailored user experience. ```php [ 'filter-route' => 'log-viewer::logs.filter', 'icons-enabled' => true, ], // ... ]; ``` -------------------------------- ### Configure Localization (Locale) - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Specifies the language used for the LogViewer interface. It supports automatic detection ('auto') or a list of predefined locales. This ensures the interface is displayed in the user's preferred language. ```php 'auto', // ... ]; ``` -------------------------------- ### Configure Pagination - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Sets the number of log entries to display per page in the LogViewer interface. This configuration helps manage the display of log data, especially for applications with a high volume of logs. ```php 30, // ... ]; ``` -------------------------------- ### LogViewer::count() - Count Log Files Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns the total number of log files available. Returns 0 if the log folder is empty. ```APIDOC ## LogViewer::count() ### Description Returns the total number of log files available. Returns 0 if the log folder is empty. ### Method GET ### Endpoint /logs/count ### Parameters None #### Request Body None ### Request Example ```php $count = LogViewer::count(); echo "Number of log files: " . $count; ``` ### Response #### Success Response (200) - **count** (int) - The total number of log files. #### Response Example ```json { "count": 5 } ``` ``` -------------------------------- ### Count Log Files - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns the total number of log files present in the configured log directory. Returns 0 if the directory is empty. ```php /** * LogViewer::count() * * @return int */ $count = LogViewer::count(); var_dump($count); // >= 0 ``` -------------------------------- ### Configure Daily Log Handler in Laravel Source: https://github.com/arcanedev/logviewer/wiki/1.-Requirements This snippet shows how to configure the application's logging mechanism to use the 'daily' log handler in Laravel's configuration file. This is a requirement for the LogViewer package. ```php // config\app.php return [ ... /*-------------------------------------------------------------------------- | Logging Configuration |-------------------------------------------------------------------------- | Available Settings: "single", "daily", "syslog", "errorlog" */ 'log' => 'daily', ... ]; ``` -------------------------------- ### Generate Log Tree Structure - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Generates a tree-like structure of log data. Can optionally include translations. This method is useful for hierarchical display of log information. ```php /** * LogViewer::tree($trans = false) * * @param bool|false $trans * * @return array */ ``` -------------------------------- ### Configure Log Storage Path - PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md Sets the directory where log files are stored. This configuration option is crucial for the LogViewer to locate and access log files. It typically points to the default Laravel storage path for logs. ```php storage_path('logs'), // ... ]; ``` -------------------------------- ### Configure Menu Settings in LogViewer (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Enables or disables the display of icons within the LogViewer menu. This setting controls the visual richness of the navigation elements. ```php [ 'icons-enabled' => true, ], ... ]; ``` -------------------------------- ### LogViewer::total() - Count Total Log Entries Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Returns the total number of all log entries. Can be filtered by log level. ```APIDOC ## LogViewer::total($level = null) ### Description Returns the total number of all log entries. Can be filtered by log level. ### Method GET ### Endpoint /logs/total ### Parameters #### Path Parameters None #### Query Parameters - **level** (string) - Optional - The log level to filter entries by (e.g., 'error'). If null, all entries are counted. #### Request Body None ### Request Example ```php // Get total entries for all levels $totalEntries = LogViewer::total(); // Get total entries for 'error' level $errorEntries = LogViewer::total('error'); ``` ### Response #### Success Response (200) - **total** (int) - The total count of log entries. #### Response Example ```json { "total": 1500 } ``` ``` -------------------------------- ### Define Log Level Colors in LogViewer (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Assigns specific hexadecimal color codes to different log levels. This configuration is used to visually highlight log entries based on their severity in the LogViewer interface. ```php [ 'levels' => [ 'empty' => '#D1D1D1', 'all' => '#8A8A8A', 'emergency' => '#B71C1C', 'alert' => '#D32F2F', 'critical' => '#F44336', 'error' => '#FF5722', 'warning' => '#FF9100', 'notice' => '#4CAF50', 'info' => '#1976D2', 'debug' => '#90CAF9', ], ], ]; ``` -------------------------------- ### Define Log Level Colors in PHP Source: https://github.com/arcanedev/logviewer/blob/master/_docs/2.Configuration.md This PHP configuration defines a map of log levels to specific hexadecimal color codes. These colors are likely used for styling log entries based on their severity, with distinct colors assigned to levels like 'emergency', 'error', and 'info'. ```php [ 'levels' => [ 'empty' => '#D1D1D1', 'all' => '#8A8A8A', 'emergency' => '#B71C1C', 'alert' => '#D32F2F', 'critical' => '#F44336', 'error' => '#FF5722', 'warning' => '#FF9100', 'notice' => '#4CAF50', 'info' => '#1976D2', 'debug' => '#90CAF9', ], ], ]; ``` -------------------------------- ### Configure Localization in LogViewer (PHP) Source: https://github.com/arcanedev/logviewer/wiki/3.-Configuration Sets the available locales for the LogViewer. This configuration option determines the language used for the application's interface. Supported locales include 'auto', 'ar', 'de', 'en', 'fr', and 'nl'. ```php 'auto', ... ]; ``` -------------------------------- ### LogViewer::delete() - Delete Log by Date Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Deletes a specific log file identified by its date. ```APIDOC ## LogViewer::delete($date) ### Description Deletes a specific log file identified by its date. ### Method DELETE ### Endpoint /logs/{date} ### Parameters #### Path Parameters - **date** (string) - Required - The date of the log file to delete. Format: YYYY-MM-DD. #### Query Parameters None #### Request Body None ### Request Example ```php $deleted = LogViewer::delete('2023-10-27'); ``` ### Response #### Success Response (200) - **status** (bool) - True if the log file was deleted successfully, false otherwise. #### Response Example ```json { "status": true } ``` ``` -------------------------------- ### Delete Log by Date - LogViewer API Source: https://github.com/arcanedev/logviewer/wiki/4.-Usage Deletes the log file for a specified date. The date must be in 'YYYY-MM-DD' format. Returns a boolean indicating success or failure. ```php /** * LogViewer::delete($date) * * @param string $date - Format : YYYY-MM-DD * * @return bool */ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.