github.com/iDigitalFlame/xmt@v0.5.1/c2/cout/v_implant.go (about) 1 //go:build implant 2 // +build implant 3 4 // Copyright (C) 2020 - 2023 iDigitalFlame 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program. If not, see <https://www.gnu.org/licenses/>. 18 // 19 20 // Package cout is a simple log handling solution for the c2 package. 21 // This is used internally to create loggers and to disable logging if needed, 22 // such as the "client" built tag being used. 23 package cout 24 25 import "github.com/PurpleSec/logx" 26 27 // Enabled is a compile time constant that can be used to disable/enable the 28 // logx Logger and prevent any un-needed fmt calls as the client does not 29 // /naturally/ need to produce output. 30 // 31 // Only needed for debug purposes. 32 const Enabled = false 33 34 var log Log 35 36 // Log is an interface for any type of struct that supports standard Logging functions. 37 type Log struct{} 38 39 // New creates a Log instance from a logx Logger. 40 func New(_ logx.Log) Log { 41 return log 42 } 43 44 // Set updates the internal logger. This function is a NOP if the logger is nil or logging is not 45 // enabled via the 'client' build tag. 46 func (Log) Set(_ logx.Log) {} 47 48 // Info writes an informational message to the logger. 49 // The function arguments are similar to fmt.Sprintf and fmt.Printf. The first argument is 50 // a string that can contain formatting characters. The second argument is a vardict of 51 // interfaces that can be omitted or used in the supplied format string. 52 func (Log) Info(_ string, _ ...interface{}) {} 53 54 // Error writes an error message to the logger. 55 // The function arguments are similar to fmt.Sprintf and fmt.Printf. The first argument is 56 // a string that can contain formatting characters. The second argument is a vardict of 57 // interfaces that can be omitted or used in the supplied format string. 58 func (Log) Error(_ string, _ ...interface{}) {} 59 60 // Trace writes a tracing message to the logger. 61 // The function arguments are similar to fmt.Sprintf and fmt.Printf. The first argument is 62 // a string that can contain formatting characters. The second argument is a vardict of 63 // interfaces that can be omitted or used in the supplied format string. 64 func (Log) Trace(_ string, _ ...interface{}) {} 65 66 // Debug writes a debugging message to the logger. 67 // The function arguments are similar to fmt.Sprintf and fmt.Printf. The first argument is 68 // a string that can contain formatting characters. The second argument is a vardict of 69 // interfaces that can be omitted or used in the supplied format string. 70 func (Log) Debug(_ string, _ ...interface{}) {} 71 72 // Warning writes a warning message to the logger. 73 // The function arguments are similar to fmt.Sprintf and fmt.Printf. The first argument is 74 // a string that can contain formatting characters. The second argument is a vardict of 75 // interfaces that can be omitted or used in the supplied format string. 76 func (Log) Warning(_ string, _ ...interface{}) {}