Documentation
¶
Overview ¶
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Lord of Scripts * goApp * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Convenience Logging functions present when "logx" tag is used. *-----------------------------------------------------------------
Index ¶
- Constants
- func GetNestingLevel(frCnt ...int) (int, string)
- type ICallTree
- type LogFilter
- type LogGate
- func (l *LogGate) Close()
- func (l *LogGate) DisableLogging()
- func (l *LogGate) EnableLogging()
- func (l *LogGate) EnableLoggingToDir(dirname string) error
- func (l *LogGate) EnableLoggingToFile(filename string) error
- func (l *LogGate) Help() string
- func (l *LogGate) IsFiltered(packageName string) bool
- func (l *LogGate) IsFilteredObject(packageName, objectName string) bool
- func (l *LogGate) LoadFilters() error
- func (l *LogGate) SaveFilters()
- func (l *LogGate) SetAppName(name string) *LogGate
- func (l *LogGate) Setup(mode string)
- func (l *LogGate) WithCallTree(filename string) *LogGate
- func (l *LogGate) WithConfigSubdirectory(subdir string) *LogGate
- func (l *LogGate) WriteCallTree(data string)
Constants ¶
const ( UC_FOOTSTEPS rune = rune(0x1f463) // 👣 UC_EXCLAMATION rune = rune(0x2757) // ❗ UC_CROSSMARK rune = rune(0x274c) // ❌ UC_CROSS rune = rune(0x2716) // ✖ UC_CHECK rune = rune(0x1f5f8) // 🗸 UC_ARROWS3 rune = rune(0x21f6) // ⇶ UC_OBSERVER rune = rune(0x23ff) // ⏿ UC_EYES rune = rune(0x1f440) // 👀 UC_EYE rune = rune(0x1f441) // 👁 )
---------------------------------------------------------------- * P u b l i c G l o b a l s *-----------------------------------------------------------------
Variables ¶
This section is empty.
Functions ¶
func GetNestingLevel ¶
*
- Gets the current nesting level with main.main() as reference and
- a string with the location (package/struct/function).
Types ¶
type LogGate ¶
type LogGate struct {
AppName string `json:"appname"`
CurrentLevel string `json:"level"` // allowed log level: NONE,FATAL,ERROR,WARN,INFO,DEBUG
Filters map[string]LogFilter `json:"filters"`
// contains filtered or unexported fields
}
var (
SingLogGate *LogGate // Singleton for App CLI parsing and Filtering
)
func GetLogGateInstance ¶
*
- Manages the Logging configuration for the application lifecycle
- Allowing to easily set it up via a CLI parameter to disable
- logging, or enable to a terminal or a named file. *
- @returns LogGate{} singleton
func (*LogGate) Close ¶
func (l *LogGate) Close()
*
- This call is only necessary if the application is logging to a file.
- In that case it is better to put a call to this on a defer statement
- on the main function.
func (*LogGate) DisableLogging ¶
func (l *LogGate) DisableLogging()
DisableLogging disables logging in the application
func (*LogGate) EnableLogging ¶
func (l *LogGate) EnableLogging()
EnableLogging enables logging for tests
func (*LogGate) EnableLoggingToDir ¶
*
- Enable logging to file.
- @returns (*os.File) so that the caller can defer Close()
func (*LogGate) EnableLoggingToFile ¶
func (*LogGate) IsFiltered ¶
*
- Checks if the packageName (GO package name format) is
- black-listed. Black-listed packages do not produce log
- output under LOGX.
func (*LogGate) IsFilteredObject ¶
*
- Checks if the packageName (GO package name format) is
- black-listed. Black-listed packages do not produce log
- output under LOGX.
func (*LogGate) LoadFilters ¶
*
- Attempts to load APPNAME.logfilters which contains a list of application/module
- packages white-listed for log output. It may contain a fine-grained configuration
- of which objects (structs) of that package are allowed. If empty all are allowed,
- else whatever struct name that is not listed becomes black-listed for logging.
func (*LogGate) SaveFilters ¶
func (l *LogGate) SaveFilters()
*
- Saves a sample Log Filter configuration file in the user's configuration
- directory. The filename is APPNAME.logfilter.
func (*LogGate) SetAppName ¶
func (*LogGate) WithCallTree ¶
func (*LogGate) WithConfigSubdirectory ¶
func (*LogGate) WriteCallTree ¶
Writes to the call tree (separate file or default output). The data string is expected WITHOUT line feed ("\n") as it will be appended here.