Skip to content

syniol/go-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SyLog

Go Logger package adopted Cloud Native principles in core.

Usage Example

Please see below for example code.

package main

import "github.com/syniol/go-logger"

func main() {
	sylog.LogAlert("mock message for alert log")
}

you could see JSON output below:

{
  "level": "alert",
  "message": "mock message for alert log",
  "trace": [
    "location: file: '/Users/hadi/dev/golang/logger/logger.go' on line: 100"
  ],
  "timestamp": "2023-11-04T21:36:33Z"
}

Log levels

Log levels for software applications have a rich history dating back to the 1980s. One of the earliest and most influential logging solutions for Unix systems, Syslog , introduced a range of severity levels, which provided the first standardised framework for categorising log entries based on their impact or urgency.

The following are the levels defined by Syslog in descending order of severity:

  • Emergency (emerg/fatal): System is unusable and requires immediate attention.
  • Alert (alert): Immediate action is necessary to resolve a critical issue.
  • Critical (crit): Critical conditions in the program that demand intervention to prevent system failure.
  • Error (error): Error conditions that impair some operation but are less severe than critical situations.
  • Warning (warn): Potential issues that may lead to errors or unexpected behavior in the future if not addressed.
  • Notice (notice): Applies to normal but significant conditions that may require monitoring.
  • Informational (info): Includes messages that provide a record of the normal operation of the system.
  • Debug (debug): Logging detailed information about the system for debugging purposes.

Credits

Copyright © 2023 Syniol Limited. All rights Reserved.