justinianus/stdio-log

There is no license information available for the latest version (dev-master) of this package.

STDIO's Log Laravel.

dev-master 2022-06-13 18:45 UTC

This package is auto-updated.

Last update: 2025-08-17 09:43:38 UTC


README

Getting started with StdioLogHelper, use Composer command to add the package to your Laravel project's dependencies.

composer require justinianus/stdio-log
composer dump-autoload

Then register new package service provider to config/app.php

'providers' => [
	Justinianus\StdioLog\StdioServiceProvider::class,
],

Setup Channel

Create new channel 'slack-log' for Slack message into config/logging.php to send message log via Slack

'slack-log' => [
	'driver' => 'slack',
	'url' => env('LOG_SLACK_WEBHOOK_URL'),
	'username' => 'Laravel Log',
	'emoji' => ':boom:',
	'level' => env('LOG_LEVEL', 'critical'),
],

Add environment variable into .env for the incoming webhook receive from Slack application.

LOG_SLACK_WEBHOOK_URL=YOUR_INCOMING_WEBHOOK_SLACK_URL

Usage

Declare library before using.

use Justinianus\StdioLog\Helpers\StdioLogHelper;

Log for Back-End

StdioLogHelper::writeFileLog(StdioLogHelper::LOG_LEVEL_CONST, 'log-channel-name', Exception $exception, Request $request, [$booleanSendSlack]);

Callback for Front-End

StdioLogHelper::callback(Request $request, [$booleanSendSlack, StdioLogHelper::LOG_LEVEL_CONST, 'log-channel-name']);