Documentation
¶
Index ¶
- func Must[Type any](result Type, except *Exception) Type
- type Exception
- type Logger
- func (logger *Logger) AddConsole() *Exception
- func (logger *Logger) AddFile(fileName string) *Exception
- func (logger *Logger) Close()
- func (logger *Logger) ConsoleOnly() *Exception
- func (logger *Logger) FileOnly(fileName string) *Exception
- func (logger *Logger) FullSetup(fileName string) *Exception
- func (logger Logger) GetLevel() LoggingLevel
- func (logger Logger) GetName() string
- func (logger *Logger) Log(message string, level LoggingLevel)
- func (logger *Logger) SetLevel(level LoggingLevel)
- func (logger *Logger) SetName(name string)
- type LoggingLevel
- type Version
- func (version Version) Compare(operand Version) bool
- func (version Version) CompareMajor(major uint8) bool
- func (version Version) CompareMinor(minor uint8) bool
- func (version Version) ComparePatch(patch uint8) bool
- func (version Version) Description() string
- func (version *Version) Fix()
- func (version Version) IsPublic() bool
- func (version Version) IsZero() bool
- func (version Version) Major() uint8
- func (version Version) Minor() uint8
- func (version Version) Name() string
- func (version Version) NumberString() string
- func (version Version) Patch() uint8
- func (version *Version) Publish() *Exception
- func (version *Version) Release()
- func (version *Version) SetDescription(description string)
- func (version *Version) SetMajor(major uint8)
- func (version *Version) SetMinor(minor uint8)
- func (version *Version) SetName(name string)
- func (version *Version) SetPatch(patch uint8)
- func (version Version) ToString() string
- func (version *Version) Update()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Exception ¶
type Exception struct {
// contains filtered or unexported fields
}
Representation of a standardized exception.
func NewException ¶
Construct a new exception with a default name and a given message. Returns a pointer to a new exception.
func NewNamedException ¶
Construct a new exception with a given name and message. Returns a pointer to a new exception.
func (Exception) Error ¶
Method to adhere to the built-in error type. Returns a string representation of the exception.
type Logger ¶ added in v0.0.3
type Logger struct {
// contains filtered or unexported fields
}
A logger.
func NewLogger ¶ added in v0.0.3
func NewLogger(name string, level LoggingLevel) *Logger
Construct a new logger with a given name and default logging level. The default logging level passed into this constructor is the minimum level of severity that will be ouput by the logger. Returns a pointer to a new logger.
func (*Logger) AddConsole ¶ added in v0.0.3
Bind the standard output to the logger. If the logger has already allocated the maximum number of allowed outputs, a ValueError is returned.
func (*Logger) AddFile ¶ added in v0.0.3
Bind a file to the logger. If the logger has already allocated the maximum number of allowed outputs, a ValueError is returned. If the given file can not be found, an Exception is returned.
func (*Logger) Close ¶ added in v0.0.4
func (logger *Logger) Close()
Deallocate the logger. If the logger has a file bound, the file will need to be closed with this method. A good practice is to call this method deferred even if a file is not bound; this method will not close the standard output.
func (*Logger) ConsoleOnly ¶ added in v0.0.3
Bind only the standard output to the logger. If the logger has already allocated the maximum number of allowed outputs, a ValueError is returned.
func (*Logger) FileOnly ¶ added in v0.0.3
Bind only a file to the logger. If the logger has already allocated the maximum number of allowed outputs, a ValueError is returned. If the given file can not be found, an Exception is returned.
func (*Logger) FullSetup ¶ added in v0.0.3
Bind both a file and the standard output to the logger. If the logger has already allocated the maximum number of allowed outputs, a ValueError is returned. If the given file can not be found, an Exception is returned.
func (Logger) GetLevel ¶ added in v1.11.0
func (logger Logger) GetLevel() LoggingLevel
Obtain the level of the logger. Returns the level of the logger.
func (Logger) GetName ¶ added in v1.11.0
Obtain the name of the logger. Returns the name of the logger.
func (*Logger) Log ¶ added in v0.0.6
func (logger *Logger) Log(message string, level LoggingLevel)
Log a message. If the default logging level of the logger is greater than the given logging level of the message, the message will not be logged.
func (*Logger) SetLevel ¶ added in v1.5.0
func (logger *Logger) SetLevel(level LoggingLevel)
Set the minimal logging level for the logger.
type LoggingLevel ¶ added in v0.0.3
type LoggingLevel = uint8
An enum representation of the severity of a log message.
const ( // Lowest severity log message. Used to log debug information for development. DEBUG LoggingLevel = iota // Used to log info that should be read. It is not an error, but is not a debug message. INFO // Used to log a non-crashing warning, such as a file already existing when calling a create function. WARNING // Used to log a non-crashing error. This level should be the default when logging an error. ERROR // Used to log a crashing error. Used to log a message of a panic or breaking state. CRITICAL )
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Representation of a semantic versioning object.
func NewFullVersion ¶
Construct a full initialized version object. Returns a pointer to a new fully initialized version object.
func NewNamedVersion ¶
Construct a new version object initialized with a given name. Returns a pointer to a new version object initialized with the given name.
func NewStringVersion ¶
Construct a new version object with each of its string properties initialized. Returns a pointer to a new version object initialized with the given string parametres.
func NewVersion ¶
func NewVersion() *Version
Construct a new zero-initialized version object. All the string properties are empty and the numeric properties are set to zero. Returns a pointer to a new version object.
func VersionConvert ¶
Construct a new version object with given numeric values. The string properties of the version object are empty. Returns a pointer to a new version object with each of the numeric properties initialized with the given parametres.
func (Version) Compare ¶
Compare each of the numeric properties of the version object to a given operand. Returns true if each of the version object's properties are greater than or equal to the given operand's numeric properties.
func (Version) CompareMajor ¶
Determine if the version object's major property is greater than or equal to the given operand. Returns true if the version object's major property is greater than or equal to the given operand.
func (Version) CompareMinor ¶
Determine if the version object's minor property is greater than or equal to the given operand. Returns true if the version object's minor property is greater than or equal to the given operand.
func (Version) ComparePatch ¶
Determine if the version object's patch property is greater than or equal to the given operand. Returns true if the version object's patch property is greater than or equal to the given operand.
func (Version) Description ¶
Access the description property of the version object. Returns the description property of the version object.
func (*Version) Fix ¶
func (version *Version) Fix()
Increment the version object's patch property. The version object's major and minor property are not modified.
func (Version) IsPublic ¶
Determine if the version object is public. Returns true if the version object's major property is evaluated greater than or equal to 1.
func (Version) IsZero ¶ added in v1.5.0
Determine if the version object is equal to zero. Returns true if each of the version object's numeric properties are equal to zero, else false.
func (Version) Major ¶
Access the major property of the version object. Returns the major property of the version object.
func (Version) Minor ¶
Access the minor property of the version object. Returns the minor property of the version object.
func (Version) Name ¶
Access the name property of the version object. Returns the name property of the version object.
func (Version) NumberString ¶ added in v1.6.0
Render a string representation of the version object's numeric properties. Returns the version object's numeric properties represented as a string.
func (Version) Patch ¶
Access the patch property of the version object. Returns the patch property of the version object.
func (*Version) Publish ¶
Publish a version object. Set the version object's major property to 1. Zero-out all other numeric properties. If the version object is evaluated to have already been published, a ValueError is returned and no properties are modified.
func (*Version) Release ¶
func (version *Version) Release()
Increment the version object's major property. The version object's minor and patch properties are set to 0.
func (*Version) SetDescription ¶
Set the description property of the version object.