Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log notice and CSS styles #328

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/app.css

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions resources/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ html.dark {
&.success {
@apply text-emerald-700 dark:text-emerald-500;
}
&.notice {
@apply text-green-700 dark:text-green-500;
}
&.info {
@apply text-sky-700 dark:text-sky-500;
}
Expand All @@ -60,6 +63,9 @@ html.dark {
&.success {
@apply text-emerald-100;
}
&.notice {
@apply text-green-100;
}
&.info {
@apply text-sky-100;
}
Expand Down Expand Up @@ -99,6 +105,18 @@ html.dark {
}
}

&.notice {
&:hover > td, &.active > td, &:focus-within > td {
@apply bg-green-50 dark:bg-green-800 dark:bg-opacity-40;
}
.log-level-indicator {
@apply bg-green-700 dark:bg-green-500;
}
.log-level {
@apply text-green-700 dark:text-green-500;
}
}

&.info {
&:hover > td, &.active > td, &:focus-within > td {
@apply bg-sky-50 dark:bg-sky-800 dark:bg-opacity-40;
Expand Down Expand Up @@ -188,6 +206,39 @@ html.dark {
}
}

&.notice {
@apply border border-green-200 bg-green-50 text-green-600
dark:border-green-800 dark:bg-green-900 dark:bg-opacity-40 dark:text-green-400;

&:hover {
@apply bg-green-100
dark:bg-green-900 dark:bg-opacity-75;
}

.checkmark {
@apply border-green-200
dark:border-green-800;
}

&.active {
@apply border-green-700 bg-green-600 text-white
dark:border-green-600 dark:bg-green-700;

&:hover {
@apply bg-green-500
dark:bg-green-800;
}
.checkmark {
@apply border-green-600
dark:border-green-700 dark:bg-green-100;
}
.checkmark > svg {
@apply text-green-600
dark:text-green-700;
}
}
}

&.info {
@apply border border-sky-200 bg-sky-50 text-gray-600
dark:border-sky-800 dark:bg-sky-900 dark:bg-opacity-40 dark:text-gray-400;
Expand Down
4 changes: 3 additions & 1 deletion src/LogLevels/HttpStatusCodeLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public function getClass(): LevelClass
{
$value = intval($this->value);

if ($value < 300) {
if ($value < 250) {
return LevelClass::notice();
} elseif ($value < 300) {
return LevelClass::success();
} elseif ($value < 400) {
return LevelClass::info();
Expand Down
3 changes: 2 additions & 1 deletion src/LogLevels/LaravelLogLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function getName(): string
public function getClass(): LevelClass
{
return match ($this->value) {
self::Debug, self::Info, self::Notice => LevelClass::info(),
self::Debug, self::Info => LevelClass::info(),
self::Notice =>LevelClass::notice(),
self::Warning => LevelClass::warning(),
self::Error, self::Critical, self::Alert, self::Emergency => LevelClass::danger(),
default => LevelClass::none(),
Expand Down
7 changes: 7 additions & 0 deletions src/LogLevels/LevelClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class LevelClass
{
const SUCCESS = 'success';
const NOTICE = 'notice';
const INFO = 'info';
const WARNING = 'warning';
const DANGER = 'danger';
Expand All @@ -24,6 +25,7 @@ public static function caseValues(): array
{
return [
static::SUCCESS,
static::NOTICE,
static::INFO,
static::WARNING,
static::DANGER,
Expand All @@ -36,6 +38,11 @@ public static function success(): static
return new static(static::SUCCESS);
}

public static function notice(): static
{
return new static(static::NOTICE);
}

public static function info(): static
{
return new static(static::INFO);
Expand Down
Loading