github.com/dubbogo/gost@v1.14.0/log/pretty.go (about) 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 // package gxlog is based on log4go. 19 // pretty.go provides pretty format string 20 package gxlog 21 22 import ( 23 "github.com/davecgh/go-spew/spew" 24 25 "github.com/k0kubun/pp" 26 ) 27 28 func PrettyString(i interface{}) string { 29 return spew.Sdump(i) 30 } 31 32 func ColorSprint(i interface{}) string { 33 return pp.Sprint(i) 34 } 35 36 func ColorSprintln(i interface{}) string { 37 return pp.Sprintln(i) 38 } 39 40 func ColorSprintf(fmt string, args ...interface{}) string { 41 return pp.Sprintf(fmt, args...) 42 } 43 44 func ColorPrint(i interface{}) { 45 pp.Print(i) 46 } 47 48 func ColorPrintln(i interface{}) { 49 pp.Println(i) 50 } 51 52 func ColorPrintf(fmt string, args ...interface{}) { 53 pp.Printf(fmt, args...) 54 }