Compare commits
No commits in common. "6df531d73b7c5f855ce9e0ce2d2fcc4d069ec5a5" and "c92275602f7689a311e4bb418d1b9c25bd7318a2" have entirely different histories.
6df531d73b
...
c92275602f
64
README.md
64
README.md
@ -19,70 +19,6 @@ The most scientifically badass logging library from the Kingdom of Science!
|
|||||||
go get gitstormr.dev/stone-utils/stonelog@latest
|
go get gitstormr.dev/stone-utils/stonelog@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## β‘ Initialization
|
|
||||||
|
|
||||||
```go
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gitstormr.dev/stone-utils/stonelog"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Basic configuration (INFO level by default)
|
|
||||||
stonelog.InitStoneLog(stonelog.INFO, false, false) // false = text mode (true = JSON), false = keep suffixes (true = don't add character quotes)
|
|
||||||
|
|
||||||
// Example logs
|
|
||||||
stonelog.Observation("System initialized successfully!")
|
|
||||||
stonelog.Failure("Reactor core temperature critical!")
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## π Log Levels (Scientific Style!)
|
|
||||||
|
|
||||||
| Function | Level Equivalent | Example Output |
|
|
||||||
|---------------|--------------------|--------------------------------------------------|
|
|
||||||
| Trace() | TRACE | π Science traces: Entering function X |
|
|
||||||
| Debug() | DEBUG | π€ Hypothesis forming: Variable X = 42 |
|
|
||||||
| Observation() | INFO | β
Experiment successful: User logged in |
|
|
||||||
| Hypothesis() | WARN | β οΈ Anomaly detected: High memory usage |
|
|
||||||
| Failure() | ERROR | π₯ Critical malfunction: DB disconnected |
|
|
||||||
| Meltdown() | FATAL | β οΈ FINAL EXPERIMENT FAILED: Server exploded |
|
|
||||||
| Panic() | PANIC | π¨ CHAIN REACTION DETECTED: Unrecoverable error |
|
|
||||||
|
|
||||||
## ποΈ Changing Log Level
|
|
||||||
|
|
||||||
```go
|
|
||||||
// Dynamic change! (e.g., enable DEBUG in production)
|
|
||||||
stonelog.SetLogLevel(stonelog.DEBUG)
|
|
||||||
```
|
|
||||||
|
|
||||||
## π¬ JSON Mode (For Production)
|
|
||||||
|
|
||||||
```go
|
|
||||||
stonelog.InitStoneLab(stonelog.STONE_DEBUG, true, false) // true = JSON, false = Keep suffixes
|
|
||||||
// Output: {"time":"2023-07-15T12:00:00Z","level":"OBSERVATION","message":"β
Experiment successful: System ready","caller":"main.go:15"}
|
|
||||||
```
|
|
||||||
|
|
||||||
## **π¨ WINDOWS COLOR SUPPORT NOTICE π¨**
|
|
||||||
|
|
||||||
*"HEY WINDOWS USERS! YOUR TERMINALS NEED SOME SCIENCE!" - Chrome*
|
|
||||||
|
|
||||||
π¬ **Current Limitations:**
|
|
||||||
- Colors don't work in old Windows Command Prompt (CMD)
|
|
||||||
- Looks boring in black & white (like stone tablets!)
|
|
||||||
- Works perfectly in modern terminals
|
|
||||||
|
|
||||||
π‘ **Senku-Approved Solutions:**
|
|
||||||
1. Install **Windows Terminal** (Microsoft Store)
|
|
||||||
2. Use **WSL** (Windows Subsystem for Linux)
|
|
||||||
3. Try **VS Code** or **Git Bash**
|
|
||||||
|
|
||||||
*"This temporary setback represents just 0.0000001% of our scientific progress!"*
|
|
||||||
- **Dr. Senku Ishigami**
|
|
||||||
|
|
||||||
*(Chrome whispers: "Pssst... Linux terminals are SO BADASS!")* π§π₯
|
|
||||||
|
|
||||||
**Join the Scientific Revolution!**
|
**Join the Scientific Revolution!**
|
||||||
|
|
||||||
> "This isn't just logging - it's 10 billion percent scientific progress!" - Senku Ishigami
|
> "This isn't just logging - it's 10 billion percent scientific progress!" - Senku Ishigami
|
||||||
|
255
log.go
255
log.go
@ -1,255 +0,0 @@
|
|||||||
package stonelog
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// logEntry represents the structure for a single log entry.
|
|
||||||
// Time is the timestamp of the log entry in RFC3339 format.
|
|
||||||
// Level specifies the severity level of the log message.
|
|
||||||
// Caller describes the source file and line generating the log.
|
|
||||||
// Message contains the actual log details or description.
|
|
||||||
type logEntry struct {
|
|
||||||
Time string `json:"time"`
|
|
||||||
Level string `json:"level"`
|
|
||||||
Caller string `json:"caller"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// StoneLevel represents the severity level of logging categories.
|
|
||||||
type StoneLevel int
|
|
||||||
|
|
||||||
// String returns the string representation of the StoneLevel.
|
|
||||||
func (l StoneLevel) String() string {
|
|
||||||
return stoneLevelNames[l]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Color returns the color code associated with the StoneLevel.
|
|
||||||
func (l StoneLevel) Color() string {
|
|
||||||
return levelColors[l]
|
|
||||||
}
|
|
||||||
|
|
||||||
// TRACE represents the trace log level.
|
|
||||||
// DEBUG represents the debug log level.
|
|
||||||
// INFO represents the info log level.
|
|
||||||
// WARN represents the warning log level.
|
|
||||||
// ERROR represents the error log level.
|
|
||||||
// FATAL represents the fatal log level.
|
|
||||||
// PANIC represents the panic log level.
|
|
||||||
const (
|
|
||||||
TRACE StoneLevel = iota
|
|
||||||
DEBUG
|
|
||||||
INFO
|
|
||||||
WARN
|
|
||||||
ERROR
|
|
||||||
FATAL
|
|
||||||
PANIC
|
|
||||||
)
|
|
||||||
|
|
||||||
// stoneLevelNames maps StoneLevel constants to their string representations.
|
|
||||||
var stoneLevelNames = map[StoneLevel]string{
|
|
||||||
TRACE: "TRACE",
|
|
||||||
DEBUG: "DEBUG",
|
|
||||||
INFO: "INFO",
|
|
||||||
WARN: "WARN",
|
|
||||||
ERROR: "ERROR",
|
|
||||||
FATAL: "FATAL",
|
|
||||||
PANIC: "PANIC",
|
|
||||||
}
|
|
||||||
|
|
||||||
// ANSI color codes for terminal text formatting.
|
|
||||||
const (
|
|
||||||
colorReset = "\033[0m"
|
|
||||||
colorRed = "\033[31m"
|
|
||||||
colorGreen = "\033[32m"
|
|
||||||
colorYellow = "\033[33m"
|
|
||||||
colorMagenta = "\033[35m"
|
|
||||||
colorCyan = "\033[36m"
|
|
||||||
colorWhite = "\033[37m"
|
|
||||||
)
|
|
||||||
|
|
||||||
// levelColors maps StoneLevel constants to their corresponding color codes.
|
|
||||||
var levelColors = map[StoneLevel]string{
|
|
||||||
TRACE: colorWhite,
|
|
||||||
DEBUG: colorCyan,
|
|
||||||
INFO: colorGreen,
|
|
||||||
WARN: colorYellow,
|
|
||||||
ERROR: colorRed,
|
|
||||||
FATAL: colorMagenta,
|
|
||||||
PANIC: colorRed + "\033[1m",
|
|
||||||
}
|
|
||||||
|
|
||||||
// stoneLogger is a logger instance for logging stone-related operations.
|
|
||||||
// currentLogLevel indicates the active logging level for stoneLogger.
|
|
||||||
// disableCharacterSuffixes disables suffixes in log outputs when true.
|
|
||||||
var (
|
|
||||||
stoneLogger *log.Logger
|
|
||||||
currentLogLevel StoneLevel
|
|
||||||
useJSON bool
|
|
||||||
callerFrameDepth = 3
|
|
||||||
disableCharacterSuffixes bool
|
|
||||||
)
|
|
||||||
|
|
||||||
// InitStoneLog initializes the logging system with the specified parameters.
|
|
||||||
// level sets the logging severity level threshold.
|
|
||||||
// jsonMode determines whether logs should be output in JSON format.
|
|
||||||
// disableSuffixes disables character suffixes in log messages.
|
|
||||||
func InitStoneLog(level StoneLevel, jsonMode, disableSuffixes bool) {
|
|
||||||
currentLogLevel = level
|
|
||||||
stoneLogger = log.New(os.Stdout, "", 0)
|
|
||||||
useJSON = jsonMode
|
|
||||||
disableCharacterSuffixes = disableSuffixes
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLogLevel sets the current log level to the specified StoneLevel.
|
|
||||||
func SetLogLevel(level StoneLevel) {
|
|
||||||
if level < TRACE || level > PANIC {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
currentLogLevel = level
|
|
||||||
Observation("Log level set to %v", level)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trace logs a message at the TRACE using the specified format and arguments.
|
|
||||||
func Trace(format string, args ...interface{}) {
|
|
||||||
logMessage(TRACE, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debug logs a message at the DEBUG level using the provided format and arguments.
|
|
||||||
func Debug(format string, args ...interface{}) {
|
|
||||||
logMessage(DEBUG, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Observation logs a message at the INFO level with optional formatting arguments.
|
|
||||||
func Observation(format string, args ...interface{}) {
|
|
||||||
logMessage(INFO, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hypothesis logs a message with WARN level using the provided format and arguments.
|
|
||||||
func Hypothesis(format string, args ...interface{}) {
|
|
||||||
logMessage(WARN, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Failure logs a message at the ERROR level using the provided format and arguments.
|
|
||||||
func Failure(format string, args ...interface{}) {
|
|
||||||
logMessage(ERROR, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Meltdown logs a message at the FATAL level and terminates the program.
|
|
||||||
func Meltdown(format string, args ...interface{}) {
|
|
||||||
logMessage(FATAL, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Panic logs a message with PANIC severity and terminates the application.
|
|
||||||
func Panic(format string, args ...interface{}) {
|
|
||||||
logMessage(PANIC, format, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// getCallerInfo retrieves the file name and line number of the caller.
|
|
||||||
// It returns the information in the format "file:line" or "unknown:0" on failure.
|
|
||||||
func getCallerInfo() string {
|
|
||||||
_, file, line, ok := runtime.Caller(callerFrameDepth)
|
|
||||||
if !ok {
|
|
||||||
return "unknown:0"
|
|
||||||
}
|
|
||||||
return filepath.Base(file) + ":" + strconv.Itoa(line)
|
|
||||||
}
|
|
||||||
|
|
||||||
// logMessage handles the logging of messages with varying severity levels.
|
|
||||||
// If the log level is below the configured threshold, it is ignored.
|
|
||||||
// Formats the message, adds a random prefix, and appends optional suffixes.
|
|
||||||
// Converts the output to JSON format if enabled or applies a custom formatter.
|
|
||||||
// Executes fatal or panic behaviors when specified severity levels are met.
|
|
||||||
func logMessage(level StoneLevel, format string, args ...interface{}) {
|
|
||||||
if level < FATAL && currentLogLevel > level {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
msg := fmt.Sprintf(format, args...)
|
|
||||||
msg = getRandomPrefix(level) + " " + msg
|
|
||||||
|
|
||||||
// Determine if success or failure quote is needed
|
|
||||||
isSuccess := level <= WARN
|
|
||||||
|
|
||||||
if !disableCharacterSuffixes {
|
|
||||||
msg += getRandomQuote(isSuccess)
|
|
||||||
}
|
|
||||||
|
|
||||||
var formatted string
|
|
||||||
|
|
||||||
if useJSON {
|
|
||||||
caller := getCallerInfo()
|
|
||||||
|
|
||||||
entry := logEntry{
|
|
||||||
Time: time.Now().UTC().Format(time.RFC3339),
|
|
||||||
Level: level.String(),
|
|
||||||
Caller: caller,
|
|
||||||
Message: msg,
|
|
||||||
}
|
|
||||||
jsonData, _ := json.Marshal(entry)
|
|
||||||
formatted = string(jsonData)
|
|
||||||
} else {
|
|
||||||
formatted = stoneFormat(level, msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle special logging behaviors for FATAL and PANIC
|
|
||||||
switch level {
|
|
||||||
case FATAL:
|
|
||||||
stoneLogger.Fatalln(formatted)
|
|
||||||
case PANIC:
|
|
||||||
stoneLogger.Panicln(formatted)
|
|
||||||
default:
|
|
||||||
stoneLogger.Println(formatted)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// getRandomPrefix returns a random prefix string based on the given StoneLevel.
|
|
||||||
// It selects from predefined lists corresponding to the severity of the level.
|
|
||||||
func getRandomPrefix(level StoneLevel) string {
|
|
||||||
// Map StoneLevel to their respective prefix slices
|
|
||||||
prefixMap := map[StoneLevel][]string{
|
|
||||||
TRACE: stoneTracePrefixes,
|
|
||||||
DEBUG: stoneDebugPrefixes,
|
|
||||||
INFO: stoneInfoPrefixes,
|
|
||||||
WARN: stoneWarnPrefixes,
|
|
||||||
ERROR: stoneErrorPrefixes,
|
|
||||||
FATAL: stonePanicPrefixes,
|
|
||||||
PANIC: stonePanicPrefixes,
|
|
||||||
}
|
|
||||||
|
|
||||||
prefixes := prefixMap[level]
|
|
||||||
|
|
||||||
// Select and return a random prefix
|
|
||||||
return prefixes[rand.Intn(len(prefixes))]
|
|
||||||
}
|
|
||||||
|
|
||||||
// getRandomQuote returns a random character quote based on success or failure.
|
|
||||||
// The isSuccess parameter indicates if the quote is for a success (true) or failure.
|
|
||||||
func getRandomQuote(isSuccess bool) string {
|
|
||||||
if isSuccess {
|
|
||||||
idx := rand.Intn(len(characterSuccessQuoteSuffixes))
|
|
||||||
return characterSuccessQuoteSuffixes[idx]
|
|
||||||
} else {
|
|
||||||
idx := rand.Intn(len(characterFailQuoteSuffixes))
|
|
||||||
return characterFailQuoteSuffixes[idx]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// stoneFormat formats a log message with level, timestamp, caller, and color.
|
|
||||||
func stoneFormat(level StoneLevel, msg string) string {
|
|
||||||
now := time.Now().UTC().Format(time.RFC3339)
|
|
||||||
caller := getCallerInfo()
|
|
||||||
return fmt.Sprintf(
|
|
||||||
"%s%s [%s] [%s] %s%s", level.Color(), now, level.String(), caller, msg,
|
|
||||||
colorReset,
|
|
||||||
)
|
|
||||||
}
|
|
114
log_test.go
114
log_test.go
@ -1,114 +0,0 @@
|
|||||||
package stonelog
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"os/exec"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Test_LogLevelString(t *testing.T) {
|
|
||||||
levelTests := []struct {
|
|
||||||
level StoneLevel
|
|
||||||
expected string
|
|
||||||
}{
|
|
||||||
{TRACE, "TRACE"},
|
|
||||||
{DEBUG, "DEBUG"},
|
|
||||||
{INFO, "INFO"},
|
|
||||||
{WARN, "WARN"},
|
|
||||||
{ERROR, "ERROR"},
|
|
||||||
{FATAL, "FATAL"},
|
|
||||||
{PANIC, "PANIC"},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range levelTests {
|
|
||||||
if tt.level.String() != tt.expected {
|
|
||||||
t.Errorf("Expected %s, got %s", tt.expected, tt.level.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_LogLevelColor(t *testing.T) {
|
|
||||||
levelTests := []struct {
|
|
||||||
level StoneLevel
|
|
||||||
expected string
|
|
||||||
}{
|
|
||||||
{TRACE, colorWhite},
|
|
||||||
{DEBUG, colorCyan},
|
|
||||||
{INFO, colorGreen},
|
|
||||||
{WARN, colorYellow},
|
|
||||||
{ERROR, colorRed},
|
|
||||||
{FATAL, colorMagenta},
|
|
||||||
{PANIC, colorRed + "\033[1m"},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range levelTests {
|
|
||||||
if tt.level.Color() != tt.expected {
|
|
||||||
t.Errorf("Expected %s, got %s", tt.expected, tt.level.Color())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_JSONLogs(t *testing.T) {
|
|
||||||
InitStoneLog(TRACE, true, false)
|
|
||||||
Trace("This is a trace log")
|
|
||||||
Debug("This is a debug log")
|
|
||||||
Observation("This is an observation log")
|
|
||||||
Hypothesis("This is a hypothesis log")
|
|
||||||
Failure("This is a failure log")
|
|
||||||
|
|
||||||
SetLogLevel(INFO)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_PlainTextLogs(t *testing.T) {
|
|
||||||
InitStoneLog(TRACE, false, false)
|
|
||||||
Trace("This is a trace log")
|
|
||||||
Debug("This is a debug log")
|
|
||||||
Observation("This is an observation log")
|
|
||||||
Hypothesis("This is a hypothesis log")
|
|
||||||
Failure("This is a failure log")
|
|
||||||
|
|
||||||
SetLogLevel(INFO)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_MutedPlainTextLogs(t *testing.T) {
|
|
||||||
InitStoneLog(ERROR, false, true)
|
|
||||||
|
|
||||||
// This won't change the log level
|
|
||||||
SetLogLevel(-1)
|
|
||||||
|
|
||||||
// Following won't appear
|
|
||||||
Trace("This is a trace log")
|
|
||||||
Debug("This is a debug log")
|
|
||||||
Observation("This is an observation log")
|
|
||||||
Hypothesis("This is a hypothesis log")
|
|
||||||
|
|
||||||
// Until this one
|
|
||||||
Failure("This is a failure log")
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_PanicPlainTextLogs(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
Observation("Recovered from panic: %v", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
InitStoneLog(TRACE, false, true)
|
|
||||||
Panic("This is a panic log")
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_FatalPlainTextLogs(t *testing.T) {
|
|
||||||
cmd := exec.Command(
|
|
||||||
"go", "run", "./testbin/main.go",
|
|
||||||
)
|
|
||||||
cmd.Env = append(cmd.Env, "TEST_FATAL=1")
|
|
||||||
|
|
||||||
err := cmd.Run()
|
|
||||||
|
|
||||||
var exitErr *exec.ExitError
|
|
||||||
if errors.As(err, &exitErr) {
|
|
||||||
if exitErr.ExitCode() != 1 {
|
|
||||||
t.Errorf("Expected exit code 1, got %d", exitErr.ExitCode())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
30
prefixes.go
30
prefixes.go
@ -1,17 +1,10 @@
|
|||||||
package stonelog
|
package stonelog
|
||||||
|
|
||||||
// stoneTracePrefixes contains prefixes for trace-level scientific messages.
|
|
||||||
// stoneDebugPrefixes contains prefixes for debug-level diagnostics and processes.
|
|
||||||
// stoneInfoPrefixes contains prefixes for informational scientific outcomes.
|
|
||||||
// stoneWarnPrefixes contains prefixes for warning-level messages of potential risks.
|
|
||||||
// stoneErrorPrefixes contains prefixes for error-level critical issues detected.
|
|
||||||
// stoneFatalPrefixes contains prefixes for fatal-level critical failures.
|
|
||||||
// stonePanicPrefixes contains prefixes for panic-level catastrophic failures.
|
|
||||||
var (
|
var (
|
||||||
stoneTracePrefixes = []string{
|
stoneTracePrefixes = []string{
|
||||||
"Science traces:",
|
"Science traces",
|
||||||
"Lab sensors detect:",
|
"Lab sensors detect",
|
||||||
"Microscope focus on:",
|
"Microscope focus on",
|
||||||
"Quantum scanner active:",
|
"Quantum scanner active:",
|
||||||
"Data particles observed:",
|
"Data particles observed:",
|
||||||
}
|
}
|
||||||
@ -48,19 +41,10 @@ var (
|
|||||||
"Hypothesis disproven:",
|
"Hypothesis disproven:",
|
||||||
}
|
}
|
||||||
|
|
||||||
stoneFatalPrefixes = []string{
|
|
||||||
"SCIENTIFIC APOCALYPSE:",
|
|
||||||
"FINAL EXPERIMENT FAILED:",
|
|
||||||
"LABORATORY SHUTDOWN:",
|
|
||||||
"CORE CRITICAL:",
|
|
||||||
"RADIOACTIVE TERMINATION:",
|
|
||||||
}
|
|
||||||
|
|
||||||
stonePanicPrefixes = []string{
|
stonePanicPrefixes = []string{
|
||||||
"CHAIN REACTION DETECTED:",
|
"‘‘‘CATASTROPHIC FAILURE!!!",
|
||||||
"SYSTEMIC COLLAPSE:",
|
"Emergency protocol FAILED:",
|
||||||
"QUANTUM CATASTROPHE:",
|
"LEAVE THE LAB!",
|
||||||
"GALACTIC-LEVEL BUG DETECTED:",
|
"‘‘‘IMMINENT NUCLEAR FUSION!!!",
|
||||||
"T-REX IN THE DATACENTER:",
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -2,9 +2,6 @@ sonar.projectKey=b97a45b2-c25d-4fd1-898d-136414896ce6
|
|||||||
sonar.projectName=mother-utils/motherlog
|
sonar.projectName=mother-utils/motherlog
|
||||||
sonar.language=go
|
sonar.language=go
|
||||||
sonar.sources=.
|
sonar.sources=.
|
||||||
sonar.exclusions=**/*_test.go, testbin/**
|
sonar.exclusions=**/*_test.go
|
||||||
sonar.tests=.
|
sonar.tests=.
|
||||||
sonar.test.inclusions=**/*_test.go
|
sonar.test.inclusions=**/*_test.go
|
||||||
sonar.go.tests.reportPaths=test-report.out
|
|
||||||
sonar.go.coverage.reportPaths=coverage.out
|
|
||||||
sonar.qualitygate.wait=true
|
|
47
suffixes.go
47
suffixes.go
@ -1,47 +0,0 @@
|
|||||||
package stonelog
|
|
||||||
|
|
||||||
// characterSuccessQuoteSuffixes contains success quote suffixes by characters.
|
|
||||||
// characterFailQuoteSuffixes contains failure quote suffixes by characters.
|
|
||||||
var (
|
|
||||||
characterSuccessQuoteSuffixes = []string{
|
|
||||||
" // Senku: '10 BILLION POINTS FOR SCIENCE! REVIVAL SUCCESSFUL!'",
|
|
||||||
" // Senku: 'Mwa-ha-ha! Another victory for the Kingdom of Science!'",
|
|
||||||
" // Senku: 'E=mcΒ², baby! Thatβs how you optimize!'",
|
|
||||||
" // Senku: 'This experiment... is a 10 billion percent success!'",
|
|
||||||
|
|
||||||
" // Chrome: 'SO BADASS! SENKU, YOUβRE A GENIUS!'",
|
|
||||||
" // Chrome: 'HOLY CRAP, SCIENCE JUST PUNCHED THE SKY!'",
|
|
||||||
" // Chrome: 'WEβRE OFFICIALLY WIZARDS NOW!'",
|
|
||||||
|
|
||||||
" // Kohaku: 'Heh. Even I couldβve done that... maybe.'",
|
|
||||||
" // Kohaku: 'Science + fists = unstoppable!'",
|
|
||||||
|
|
||||||
" // Ryusui: 'NAVIGATION SUCCESSFUL! Time to monetize this!'",
|
|
||||||
" // Ryusui: 'Money canβt buy this... BUT IβLL TRY!'",
|
|
||||||
|
|
||||||
" // Kaseki: 'HOT BLOODED ENGINEERING... PERFECTED! (αα£α)Υ'",
|
|
||||||
" // Kaseki: 'IβLL CARVE A STATUE TO COMMEMORATE THIS MOMENT!'",
|
|
||||||
}
|
|
||||||
|
|
||||||
characterFailQuoteSuffixes = []string{
|
|
||||||
" // Senku: '10 BILLION REASONS TO FIX THIS... NOW.'",
|
|
||||||
" // Senku: 'This failure is... statistically impressive.'",
|
|
||||||
" // Senku: 'Mwa-ha-ha... *nervous laugh*... reboot everything.'",
|
|
||||||
|
|
||||||
" // Chrome: 'NOT BADASS! NOT BADASS AT ALL! (β₯οΉβ₯)'",
|
|
||||||
" // Chrome: 'MY BRAIN HURTS! IS THIS HOW SCIENCE WORKS?!'",
|
|
||||||
|
|
||||||
" // Kohaku: 'Ugh. Can I just smash the server with a rock?'",
|
|
||||||
" // Kohaku: 'Senku, your science is broken. FIX IT.'",
|
|
||||||
|
|
||||||
" // Gen: 'Ah~... so this is how the world ends~?'",
|
|
||||||
" // Gen: 'Mentally calculating... yep, weβre doomed~.'",
|
|
||||||
|
|
||||||
" // Tsukasa: '...This is why I opposed technology.'",
|
|
||||||
|
|
||||||
" // Kaseki: 'BACK IN MY DAY, ERRORS WERE FIXED WITH A HAMMER! π¨'",
|
|
||||||
" // Kaseki: 'MY SOUL... IT BURNS WITH DEBUGGING RAGE!!!'",
|
|
||||||
|
|
||||||
" // Francois: 'Iβll prepare a funeral tea for the deceased process.'",
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,14 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"gitstormr.dev/stone-utils/stonelog"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
if os.Getenv("TEST_FATAL") == "1" {
|
|
||||||
stonelog.InitStoneLog(stonelog.TRACE, false, false)
|
|
||||||
stonelog.Meltdown("A fatal error occurred")
|
|
||||||
}
|
|
||||||
}
|
|
Loadingβ¦
x
Reference in New Issue
Block a user