Tags: l50/goutils
Tags
Enhanced Kubernetes dynamic execution and client operations **Added:** - Added ExecutorCreator interface to abstract SPDYExecutor creation. - Introduced DefaultExecutorCreator with NewSPDYExecutor method. - Implemented detailed documentation for new ExecutorCreator in README.md. - Added comprehensive tests for new execution structure in execution_test.go. - Added `KubernetesClientInterface` to define the interface for `KubernetesClient`. - Introduced `RealKubernetesClient` as an implementation of `KubernetesClientInterface`. - Added extensive inline documentation to the methods of `RealKubernetesClient`. - Updated unit tests in `client_test.go` to use mock implementations of the new interface. **Changed:** - Updated ExecKubernetesResources to utilize ExecutorCreator. - Modified README.md to reflect new parameters and structure in execution method. - Enhanced execution.go with new interface and improved command execution logic. - Refactored `NewKubernetesClient` function to accept `KubernetesClientInterface`. - Updated function calls in existing code to use the new interface methods. - Enhanced error checking and added validation for `ExecKubernetesResources` function. - Fixed potential nil pointer dereferences in `deploymentLogger.go` and `serviceLogger.go` by adding checks before accessing objects. - Update go mods - Replaced return of *kubernetes.Clientset with interface **Removed:** - Removed outdated blackfriday v1.6.0 entries from go.sum to clean up dependencies. - Failing test that doesn't crash
Added DetermineLogLevel function and tests for logging **Added:** - `DetermineLogLevel` function in `loginfo.go` to determine the log level from a given string. - Test cases for `DetermineLogLevel` function in `loginfo_test.go` using table-driven tests. **Changed:** - Bumped go version to `1.22` in `go.mod` and `go.sum` files.
Enhance Logging and Pre-Commit Hooks (#545) Implemented Close Method for Loggers and Enhanced Logging System **Added:** - `Close` method in ColorLogger and PlainLogger for effective log file handling. - Logger interface extended with `Close` method. - Examples and tests updated to include `Close` method. **Changed:** - Adjusted `ConfigureLogger` to align with new `Close` method. - Minor readability enhancement in `logutils.go`. - Refactored `ColorLogger` to use static color settings. - Improved PrettyHandler tests for no color codes in output. - Updated test messages to include ANSI color codes. - Refined output validation in PrettyHandler tests. - Enhanced `run-go-tests.sh` and `go-vet.sh` scripts for performance. - Moved `CreateLogFile()` and `ConfigureLogger()` to `LogConfig` struct. - Updated `README.md` and code comments for new logging structure. - Modified ColorLogger methods for direct slog.Record use. - Simplified log message construction in loggers. - Enhanced JSON log parsing in `PrettyHandler`. - Optimized `ColorLogger` methods for performance. - Updated `NewPrettyHandler` for structured formatting and colorization. - Refined `Handle` method in `PrettyHandler` for improved log processing. - Added `outputToFile`, `outputJSON`, and `outputFormatted` methods in `PrettyHandler`. - Introduced `parseLogRecord` and `colorizeBasedOnLevel` methods in `PrettyHandler`. **Removed:** - Redundant `Close()` method from loggers. - Obsolete code and comments from PrettyHandler. - Unused imports for streamlined code. **Fixed:** - Color codes issue in JSON output and random {} in color output. - Corrected test assertion logic in PrettyHandler tests. - Resolved SC2207 ShellCheck warnings. - Addressed go vet and test script issues in CI. - Fixed markdown formatting in `README.md`. **Performance Improvements:** - Increased pre-commit run speed and script robustness.
PreviousNext