Closed titpetric closed 2 months ago
API Changes
--- prev.txt 2024-09-05 13:48:42.156647569 +0000
+++ current.txt 2024-09-05 13:48:38.888660046 +0000
@@ -5247,10 +5247,6 @@
// If not set or left empty, it will default to `info`.
LogLevel string `json:"log_level"`
- // You can now configure the log format to be either the standard or json format
- // If not set or left empty, it will default to `standard`.
- LogFormat string `json:"log_format"`
-
// Section for configuring OpenTracing support
// Deprecated: use OpenTelemetry instead.
Tracer Tracer `json:"tracing"`
@@ -8125,6 +8121,8 @@
func (gw *Gateway) InitHostCheckManager(ctx context.Context, store storage.Handler)
+func (gw *Gateway) InitializeRPCCache()
+
func (gw *Gateway) LoadAPI(specs ...*APISpec) (out []*APISpec)
func (gw *Gateway) LoadDefinitionsFromRPCBackup() ([]*APISpec, error)
@@ -10408,57 +10406,25 @@
FUNCTIONS
func Get() *logrus.Logger
- Get returns the default configured logger.
-
func GetRaw() *logrus.Logger
- GetRaw is used internally. Should likely be removed first, do not rely on
- it.
-
func LoadTranslations(thing map[string]interface{})
LoadTranslations takes a map[string]interface and flattens it to
- map[string]string. Because translations have been loaded - we internally
- override log the formatter. Nested entries are accessible using dot
- notation.
-
- Example: `{"foo": {"bar": "baz"}}` Flattened: `foo.bar: baz`
+ map[string]string Because translations have been loaded - we internally
+ override log the formatter Nested entries are accessible using dot notation.
+ example: `{"foo": {"bar": "baz"}}` flattened: `foo.bar: baz`
-func NewFormatter(format string) logrus.Formatter
TYPES
-type JSONFormatter struct {
- // TimestampFormat sets the format used for marshaling timestamps.
- // The format to use is the same than for time.Format or time.Parse from the standard
- // library.
- // The standard Library already provides a set of predefined format.
- TimestampFormat string
-
- // DisableTimestamp allows disabling automatic timestamps in output.
- DisableTimestamp bool
-
- // DataKey allows users to put all the log entry parameters into a nested dictionary at a given key.
- DataKey string
-}
- JSONFormatter formats logs into parsable json.
-
-func (f *JSONFormatter) Format(entry *logrus.Entry) ([]byte, error)
- Format renders a single log entry
-
type RawFormatter struct{}
- RawFormatter returns the logrus entry message as bytes.
func (f *RawFormatter) Format(entry *logrus.Entry) ([]byte, error)
- Format returns the entry.Message as a []byte.
type TranslationFormatter struct {
- logrus.Formatter
+ *logrus.TextFormatter
}
- TranslationFormatter handles message reformatting with translations.
func (t *TranslationFormatter) Format(entry *logrus.Entry) ([]byte, error)
- Format will translate the log message based on the message code. This is a
- HTTP response code if provided. The message is usually just "Finished" for
- those cases, this would likely produce a better log message.
# Package: ./regexp
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪ |
🧪 No relevant tests |
🔒 No security concerns identified |
⚡ Key issues to review Function Renaming The renaming of `initRPCCache` to `InitializeRPCCache` and `initSystem` to `initialiseSystem` may impact existing references or documentation that need to be updated to reflect these changes. Major Refactoring Significant changes in logging functionality, including removal of JSON formatter and introduction of new formatter logic, could affect how logs are processed and displayed. This needs thorough testing to ensure compatibility and correctness. |
No code suggestions found for the PR.
Failed conditions
43.8% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)
See analysis details on SonarCloud
Catch issues before they fail your Quality Gate with our IDE extension SonarLint
User description
Reverts TykTechnologies/tyk#6484
PR Type
enhancement, bug fix
Description
LogFormat
configuration option from the codebase and related schema.github.com/goccy/go-json
dependency from the project.Changes walkthrough 📝
config.go
Remove LogFormat configuration option
config/config.go - Removed the `LogFormat` configuration option.
server.go
Refactor and rename initialization functions
gateway/server.go
initRPCCache
toInitializeRPCCache
.initSystem
toinitialiseSystem
.testutil.go
Update test setup function name
gateway/testutil.go - Renamed `initSystem` to `initialiseSystem` in test setup.
log.go
Simplify log formatter setup and remove JSONFormatter
log/log.go
schema.json
Remove log_format option from schema
cli/linter/schema.json - Removed `log_format` configuration option from schema.
go.mod
Remove go-json dependency
go.mod - Removed dependency on `github.com/goccy/go-json`.
go.sum
Remove go-json checksums
go.sum - Removed checksums for `github.com/goccy/go-json`.