github.com/blend/go-sdk@v1.20220411.3/logger/constants.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package logger 9 10 import "time" 11 12 const ( 13 // FlagAll enables all flags by default. 14 FlagAll = "all" 15 // FlagNone disables all flags by default. 16 FlagNone = "none" 17 // Fatal controls errors that should be considered process ending. 18 Fatal = "fatal" 19 // Error controls errors that should be logged by default and may affect user behavior. 20 Error = "error" 21 // Warning controls errors that should be skipped by default but may help debugging. 22 Warning = "warning" 23 // Debug controls output that is useful when diagnosing issues. 24 Debug = "debug" 25 // Info controls output that is useful for output by default. 26 Info = "info" 27 // Audit controls events that indiciate security related information. 28 Audit = "audit" 29 ) 30 31 const ( 32 // ScopeAll is a special scope that matches all scopes. 33 ScopeAll = "*" 34 ) 35 36 // Output Formats 37 const ( 38 FormatJSON = "json" 39 FormatText = "text" 40 ) 41 42 // Default flags 43 var ( 44 DefaultFlags = []string{Info, Error, Fatal} 45 DefaultFlagsWritable = []string{FlagAll} 46 DefaultScopes = []string{ScopeAll} 47 DefaultWritableScopes = []string{ScopeAll} 48 DefaultListenerName = "default" 49 DefaultRecoverPanics = true 50 ) 51 52 // Environment Variable Names 53 const ( 54 EnvVarFlags = "LOG_FLAGS" 55 EnvVarFormat = "LOG_FORMAT" 56 EnvVarNoColor = "NO_COLOR" 57 EnvVarHideTime = "LOG_HIDE_TIME" 58 EnvVarTimeFormat = "LOG_TIME_FORMAT" 59 EnvVarJSONPretty = "LOG_JSON_PRETTY" 60 ) 61 62 const ( 63 // DefaultBufferPoolSize is the default buffer pool size. 64 DefaultBufferPoolSize = 1 << 8 // 256 65 // DefaultTextTimeFormat is the default time format. 66 DefaultTextTimeFormat = time.RFC3339Nano 67 // DefaultTextWriterUseColor is a default setting for writers. 68 DefaultTextWriterUseColor = true 69 // DefaultTextWriterShowHeadings is a default setting for writers. 70 DefaultTextWriterShowHeadings = true 71 // DefaultTextWriterShowTimestamp is a default setting for writers. 72 DefaultTextWriterShowTimestamp = true 73 ) 74 75 const ( 76 // DefaultWorkerQueueDepth is the default depth per listener to queue work. 77 // It's currently set to 256k entries. 78 DefaultWorkerQueueDepth = 1 << 10 79 ) 80 81 // String constants 82 const ( 83 Space = " " 84 Newline = "\n" 85 ) 86 87 // Common json fields 88 const ( 89 FieldFlag = "flag" 90 FieldTimestamp = "_timestamp" 91 FieldScopePath = "scope_path" 92 FieldText = "text" 93 FieldElapsed = "elapsed" 94 FieldLabels = "labels" 95 FieldAnnotations = "annotations" 96 ) 97 98 // JSON Formatter defaults 99 const ( 100 DefaultJSONPretty = false 101 )