Skip to content

Commit 65fbffa

Browse files
author
dvogt23
committed
Notes/personal/home/furniture.md
Notes/tech/coding/rails.md Notes/templates/file tasks.md
1 parent c94a1d3 commit 65fbffa

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

Notes/personal/home/furniture.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
- [Inzpero](https://inzpero.de/)
6262
- [ARTlistic](https://artlistic.com)
63+
- [postera.art](postera.art)
6364

6465
## Roof
6566

Notes/tech/coding/rails.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,54 @@ def matcher(**data)
6666
end
6767
```
6868
Source: [fly.io](https://fly.io/ruby-dispatch/pattern-matching-on-ruby-objects/)
69+
70+
### Colorize logger
71+
```ruby
72+
module ColorizedLogger
73+
COLOR_CODES = {
74+
debug: "\e[36m", # Cyan
75+
info: "\e[32m", # Green
76+
warn: "\e[33m", # Yellow
77+
error: "\e[31m", # Red
78+
fatal: "\e[35m", # Magenta
79+
unknown: "\e[37m" # White (or terminal default)
80+
}.freeze
81+
82+
RESET = "\e[0m"
83+
84+
def debug(progname = nil, &block)
85+
super(colorize(:debug, progname, &block))
86+
end
87+
88+
def info(progname = nil, &block)
89+
super(colorize(:info, progname, &block))
90+
end
91+
92+
def warn(progname = nil, &block)
93+
super(colorize(:warn, progname, &block))
94+
end
95+
96+
def error(progname = nil, &block)
97+
super(colorize(:error, progname, &block))
98+
end
99+
100+
def fatal(progname = nil, &block)
101+
super(colorize(:fatal, progname, &block))
102+
end
103+
104+
def unknown(progname = nil, &block)
105+
super(colorize(:unknown, progname, &block))
106+
end
107+
108+
private
109+
110+
def colorize(level, message, &block)
111+
"#{COLOR_CODES[level]}#{message || (block && block.call)}#{RESET}"
112+
end
113+
end
114+
115+
Rails.logger.extend(ColorizedLogger)
116+
```
69117
### Test coverage pre-commit hook
70118

71119
To get an positive exit code for pre-commit hook integration you have to add this to your spec config:

Notes/templates/file tasks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ path includes diary
33
not done
44
filter by function task.description.includes(query.file.filenameWithoutExtension)
55
hide task count
6+
hide postpone button
7+
hide backlink
68
```

0 commit comments

Comments
 (0)