diff --git a/bin/dev b/bin/dev index 1f535cd..2addef7 100755 --- a/bin/dev +++ b/bin/dev @@ -10,10 +10,11 @@ fi # ---------------------------------------------------------------------- if [[ -d public/assets ]]; then + echo echo "You have probably precompiled assets for production purpose!" - echo "Would you like to remove these assets before running in DEV:" - echo "- Press Enter to continue" - echo "- Press Ctrl+C to cancel" + echo + echo "Would you like to remove these assets before running in DEV?" + echo "-- Press Enter to confirm / Ctrl+C to cancel" read rm -rf public/assets fi diff --git a/bin/dev_as_prod b/bin/dev_as_prod new file mode 100755 index 0000000..ea7e8cd --- /dev/null +++ b/bin/dev_as_prod @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +export RAILS_ENV=production +export SECRET_KEY_BASE=42 +export SEMANTIC_LOGGER_APP=egr + +if [[ -d public/assets ]]; then + echo "ASSETS are already precompiled: MODIFIED_TIME" +else + rails assets:precompile +fi + +rails server + +# TO REMOVE PROD assets: +# rm -rf public/assets + +# journalctl --all -o cat --full -t egr +# journalctl --all -o short -full --no-hostname -t egr -f diff --git a/bin/journal_reverse b/bin/journal_reverse new file mode 100755 index 0000000..1490ba9 --- /dev/null +++ b/bin/journal_reverse @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +SEMANTIC_LOGGER_APP=egr journalctl --all -o short --no-hostname -t $SEMANTIC_LOGGER_APP --reverse diff --git a/bin/journal_tail b/bin/journal_tail new file mode 100755 index 0000000..916135c --- /dev/null +++ b/bin/journal_tail @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +export RAILS_ENV=production +export SECRET_KEY_BASE=42 +export SEMANTIC_LOGGER_APP=egr + +# TODO: current user belong to `adm` group + +journalctl --all -o short --no-hostname -t $SEMANTIC_LOGGER_APP -f +# journalctl --all -o cat -t $SEMANTIC_LOGGER_APP -f diff --git a/bin/sprod b/bin/sprod deleted file mode 100644 index 8d2c7ba..0000000 --- a/bin/sprod +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -RAILS_ENV=production SECRET_KEY_BASE='toto est fluo' rails assets:precompile -# TO REMOVE PROD assets: -# rm -rf public/assets - -SEMANTIC_LOGGER_APP=egr RAILS_ENV=production SECRET_KEY_BASE='toto est fluo' rails server - -# journalctl --all -o cat --full -t egr -journalctl --all -o short --no-hostname -t egr -f diff --git a/lib/semantic/abstract_formatter.rb b/lib/semantic/abstract_formatter.rb index 8a4c9bb..0f653db 100644 --- a/lib/semantic/abstract_formatter.rb +++ b/lib/semantic/abstract_formatter.rb @@ -6,14 +6,8 @@ module Semantic CENTER_SIZE = 20 TAG_FIXED_LENGTH = Rails.application.config.x.action_controller.main_session_tag_fixed_length || 10 - def initialize(time_format: nil) - super(color_map: ColorMap.new( - debug: CLEAR + TEXT_GRAY_400, - info: CLEAR + TEXT_GRAY_100, - warn: CLEAR + BG_YELLOW + TEXT_BLACK, - error: CLEAR + DARK_BG_RED + TEXT_WHITE, - fatal: CLEAR + BG_MAGENTA + BOLD + TEXT_WHITE - )) + def initialize(color_map:, time_format: nil) + super(color_map:) @time_format = time_format end diff --git a/lib/semantic/basic_formatter.rb b/lib/semantic/basic_formatter.rb index c17014e..e583fe7 100644 --- a/lib/semantic/basic_formatter.rb +++ b/lib/semantic/basic_formatter.rb @@ -1,14 +1,18 @@ module Semantic # My Custom colorized formatter class BasicFormatter < AbstractFormatter - ANSI_REVERSED_WARNING = "\e[0;30;43m".freeze - ANSI_REVERSED_ERROR = "\e[1;30;41m".freeze MAX_LENGTH_LINE = 255 PRIME = '▍'.freeze CONTINATION = '▕'.freeze def initialize(time_format: nil) - super + super(time_format:, color_map: ColorMap.new( + debug: TEXT_GRAY_400, + info: TEXT_GREEN, + warn: TEXT_YELLOW, + error: LIGHT_TEXT_RED, + fatal: TEXT_MAGENTA + )) end def call(log, logger) diff --git a/lib/semantic/fancy_formatter.rb b/lib/semantic/fancy_formatter.rb index b2d66ed..c495933 100644 --- a/lib/semantic/fancy_formatter.rb +++ b/lib/semantic/fancy_formatter.rb @@ -13,7 +13,13 @@ module Semantic TOTAL_RENDERED_VIEW_DURATION = RENDERED_VIEW_DURATION * 5 def initialize(time_format: nil) - super + super(time_format:, color_map: ColorMap.new( + debug: CLEAR + TEXT_GRAY_400, + info: CLEAR + TEXT_GRAY_100, + warn: CLEAR + BG_YELLOW + TEXT_BLACK, + error: CLEAR + DARK_BG_RED + TEXT_WHITE, + fatal: CLEAR + BG_MAGENTA + BOLD + TEXT_WHITE + )) @memory = nil end