github.com/goravel/framework@v1.13.9/queue/log.go (about) 1 package queue 2 3 import ( 4 "github.com/goravel/framework/contracts/log" 5 ) 6 7 type Debug struct { 8 debug bool 9 log log.Log 10 } 11 12 func NewDebug(debug bool, log log.Log) *Debug { 13 return &Debug{ 14 debug: debug, 15 log: log, 16 } 17 } 18 19 func (r *Debug) Print(args ...any) { 20 if r.debug { 21 r.log.Debug(args...) 22 } 23 } 24 25 func (r *Debug) Printf(format string, args ...any) { 26 if r.debug { 27 r.log.Debugf(format, args...) 28 } 29 } 30 31 func (r *Debug) Println(args ...any) { 32 if r.debug { 33 r.log.Debug(args...) 34 } 35 } 36 37 func (r *Debug) Fatal(args ...any) { 38 r.log.Error(args...) 39 } 40 41 func (r *Debug) Fatalf(format string, args ...any) { 42 r.log.Errorf(format, args...) 43 } 44 45 func (r *Debug) Fatalln(args ...any) { 46 r.log.Error(args...) 47 } 48 49 func (r *Debug) Panic(args ...any) { 50 r.log.Panic(args...) 51 } 52 53 func (r *Debug) Panicf(format string, args ...any) { 54 r.log.Panicf(format, args...) 55 } 56 57 func (r *Debug) Panicln(args ...any) { 58 r.log.Panic(args...) 59 } 60 61 type Info struct { 62 debug bool 63 log log.Log 64 } 65 66 func NewInfo(debug bool, log log.Log) *Info { 67 return &Info{ 68 debug: debug, 69 log: log, 70 } 71 } 72 73 func (r *Info) Print(args ...any) { 74 if r.debug { 75 r.log.Info(args...) 76 } 77 } 78 79 func (r *Info) Printf(format string, args ...any) { 80 if r.debug { 81 r.log.Infof(format, args...) 82 } 83 } 84 85 func (r *Info) Println(args ...any) { 86 if r.debug { 87 r.log.Info(args...) 88 } 89 } 90 91 func (r *Info) Fatal(args ...any) { 92 r.log.Error(args...) 93 } 94 95 func (r *Info) Fatalf(format string, args ...any) { 96 r.log.Errorf(format, args...) 97 } 98 99 func (r *Info) Fatalln(args ...any) { 100 r.log.Error(args...) 101 } 102 103 func (r *Info) Panic(args ...any) { 104 r.log.Panic(args...) 105 } 106 107 func (r *Info) Panicf(format string, args ...any) { 108 r.log.Panicf(format, args...) 109 } 110 111 func (r *Info) Panicln(args ...any) { 112 r.log.Panic(args...) 113 } 114 115 type Warning struct { 116 debug bool 117 log log.Log 118 } 119 120 func NewWarning(debug bool, log log.Log) *Warning { 121 return &Warning{ 122 debug: debug, 123 log: log, 124 } 125 } 126 127 func (r *Warning) Print(args ...any) { 128 r.log.Warning(args...) 129 } 130 131 func (r *Warning) Printf(format string, args ...any) { 132 r.log.Warningf(format, args...) 133 } 134 135 func (r *Warning) Println(args ...any) { 136 r.log.Warning(args...) 137 } 138 139 func (r *Warning) Fatal(args ...any) { 140 r.log.Error(args...) 141 } 142 143 func (r *Warning) Fatalf(format string, args ...any) { 144 r.log.Errorf(format, args...) 145 } 146 147 func (r *Warning) Fatalln(args ...any) { 148 r.log.Error(args...) 149 } 150 151 func (r *Warning) Panic(args ...any) { 152 r.log.Panic(args...) 153 } 154 155 func (r *Warning) Panicf(format string, args ...any) { 156 r.log.Panicf(format, args...) 157 } 158 159 func (r *Warning) Panicln(args ...any) { 160 r.log.Panic(args...) 161 } 162 163 type Error struct { 164 debug bool 165 log log.Log 166 } 167 168 func NewError(debug bool, log log.Log) *Error { 169 return &Error{ 170 debug: debug, 171 log: log, 172 } 173 } 174 175 func (r *Error) Print(args ...any) { 176 r.log.Error(args...) 177 } 178 179 func (r *Error) Printf(format string, args ...any) { 180 r.log.Errorf(format, args...) 181 } 182 183 func (r *Error) Println(args ...any) { 184 r.log.Error(args...) 185 } 186 187 func (r *Error) Fatal(args ...any) { 188 r.log.Error(args...) 189 } 190 191 func (r *Error) Fatalf(format string, args ...any) { 192 r.log.Errorf(format, args...) 193 } 194 195 func (r *Error) Fatalln(args ...any) { 196 r.log.Error(args...) 197 } 198 199 func (r *Error) Panic(args ...any) { 200 r.log.Panic(args...) 201 } 202 203 func (r *Error) Panicf(format string, args ...any) { 204 r.log.Panicf(format, args...) 205 } 206 207 func (r *Error) Panicln(args ...any) { 208 r.log.Panic(args...) 209 } 210 211 type Fatal struct { 212 debug bool 213 log log.Log 214 } 215 216 func NewFatal(debug bool, log log.Log) *Fatal { 217 return &Fatal{ 218 debug: debug, 219 log: log, 220 } 221 } 222 223 func (r *Fatal) Print(args ...any) { 224 r.log.Fatal(args...) 225 } 226 227 func (r *Fatal) Printf(format string, args ...any) { 228 r.log.Fatalf(format, args...) 229 } 230 231 func (r *Fatal) Println(args ...any) { 232 r.log.Fatal(args...) 233 } 234 235 func (r *Fatal) Fatal(args ...any) { 236 r.log.Fatal(args...) 237 } 238 239 func (r *Fatal) Fatalf(format string, args ...any) { 240 r.log.Fatalf(format, args...) 241 } 242 243 func (r *Fatal) Fatalln(args ...any) { 244 r.log.Fatal(args...) 245 } 246 247 func (r *Fatal) Panic(args ...any) { 248 r.log.Panic(args...) 249 } 250 251 func (r *Fatal) Panicf(format string, args ...any) { 252 r.log.Panicf(format, args...) 253 } 254 255 func (r *Fatal) Panicln(args ...any) { 256 r.log.Panic(args...) 257 }