TextFormatter formats logs into text
| 28 | |
| 29 | // TextFormatter formats logs into text |
| 30 | type TextFormatter struct { |
| 31 | // Set to true to bypass checking for a TTY before outputting colors. |
| 32 | ForceColors bool |
| 33 | |
| 34 | // Force disabling colors. |
| 35 | DisableColors bool |
| 36 | |
| 37 | // Force quoting of all values |
| 38 | ForceQuote bool |
| 39 | |
| 40 | // DisableQuote disables quoting for all values. |
| 41 | // DisableQuote will have a lower priority than ForceQuote. |
| 42 | // If both of them are set to true, quote will be forced on all values. |
| 43 | DisableQuote bool |
| 44 | |
| 45 | // Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/ |
| 46 | EnvironmentOverrideColors bool |
| 47 | |
| 48 | // Disable timestamp logging. useful when output is redirected to logging |
| 49 | // system that already adds timestamps. |
| 50 | DisableTimestamp bool |
| 51 | |
| 52 | // Enable logging the full timestamp when a TTY is attached instead of just |
| 53 | // the time passed since beginning of execution. |
| 54 | FullTimestamp bool |
| 55 | |
| 56 | // TimestampFormat to use for display when a full timestamp is printed. |
| 57 | // The format to use is the same than for time.Format or time.Parse from the standard |
| 58 | // library. |
| 59 | // The standard Library already provides a set of predefined format. |
| 60 | TimestampFormat string |
| 61 | |
| 62 | // The fields are sorted by default for a consistent output. For applications |
| 63 | // that log extremely frequently and don't use the JSON formatter this may not |
| 64 | // be desired. |
| 65 | DisableSorting bool |
| 66 | |
| 67 | // The keys sorting function, when uninitialized it uses sort.Strings. |
| 68 | SortingFunc func([]string) |
| 69 | |
| 70 | // Disables the truncation of the level text to 4 characters. |
| 71 | DisableLevelTruncation bool |
| 72 | |
| 73 | // PadLevelText Adds padding the level text so that all the levels output at the same length |
| 74 | // PadLevelText is a superset of the DisableLevelTruncation option |
| 75 | PadLevelText bool |
| 76 | |
| 77 | // QuoteEmptyFields will wrap empty fields in quotes if true |
| 78 | QuoteEmptyFields bool |
| 79 | |
| 80 | // Whether the logger's out is to a terminal |
| 81 | isTerminal bool |
| 82 | |
| 83 | // FieldMap allows users to customize the names of keys for default fields. |
| 84 | // As an example: |
| 85 | // formatter := &TextFormatter{ |
| 86 | // FieldMap: FieldMap{ |
| 87 | // FieldKeyTime: "@timestamp", |
nothing calls this directly
no outgoing calls
no test coverage detected