{"id":16797133,"url":"https://github.com/jdockerty/simplylog","last_synced_at":"2025-07-04T11:34:01.882Z","repository":{"id":115787131,"uuid":"333936583","full_name":"jdockerty/simplylog","owner":"jdockerty","description":"Lightweight and simplistic logging implementation, inspired by Dave Cheney.","archived":false,"fork":false,"pushed_at":"2021-01-31T16:11:41.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-17T21:28:32.123Z","etag":null,"topics":["go","golang","logging","logging-library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdockerty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-28T20:49:54.000Z","updated_at":"2024-06-19T11:06:34.765Z","dependencies_parsed_at":null,"dependency_job_id":"dcd9afe0-ec7a-4767-ae66-49726ec52a94","html_url":"https://github.com/jdockerty/simplylog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jdockerty/simplylog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fsimplylog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fsimplylog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fsimplylog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fsimplylog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdockerty","download_url":"https://codeload.github.com/jdockerty/simplylog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fsimplylog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263502129,"owners_count":23476540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","logging","logging-library"],"created_at":"2024-10-13T09:21:14.419Z","updated_at":"2025-07-04T11:34:01.860Z","avatar_url":"https://github.com/jdockerty.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimplyLog\n\nA simple, lightweight logging package that was inspired by an old article written by Dave Cheney on [Golang logging](https://dave.cheney.net/2015/11/05/lets-talk-about-logging). To summarise, a lot of logging packges offer too much functionality, a bunch of the 'logging levels' are left unused. This leaves us with `Info` and `Debug`:\n\n* **Info** is utilised by the user of your program, it provides *information* about things which are useful to them.\n* **Debug** is put in place to aid another developer/support engineer who is required to troubleshoot the software that has been deployed or to aid yourself in the actual development process - these should be used frequently throughout a program.\n\n\nThis package is an attempt to remedy this, whilst also being a great exercise in implementing logging for myself.\n\n## Installation\n\nFirstly, you should install the package using `go get`\n\n    go get -u github.com/jdockerty/simplylog\n\n## Usage\nA simple example of how this package works can be seen below\n```go\npackage main\n\nimport (\n    \"github.com/jdockerty/simplylog\"\n)\n\nfunc main() {\n\tlogger := simplylog.New()\t\n\n\tlogger.Info(\"My informational message!\")\n\n\t// The package defaults to only printing out 'Info'.\n\tlogger.Debug(\"This will not be printed yet\")\n\n\t// Setting verbose to be true enables the printing of 'Debug' messages\n\tlogger.Verbose = true\n\n\tlogger.Debug(\"This will be printed, verbose is true!\")\n}\n```\nThis works much in the same way you would expect, although it gets straight to the point without any complex setup. If you wish to see `Debug` output then set the `Verbose` field to true, otherwise you do not have to change it.\n\nA more configured example, would be something along the lines of\n\n```go\npackage main\n\nimport (\n\t\"github.com/jdockerty/simplylog\"\n\t\"os\"\n)\n\nfunc main() {\n\n\tlogger := simplylog.New()\n\n\tlogger.Verbose = true\n\tlogger.Format.SetType(\"JSON\")\n\tlogger.Format.SetTimestamp(\"2006/1/2 15:04\")\n\n\tf, err := os.OpenFile(\"program-output.log\", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0755)\n\tif err != nil {\n\t\t// Handle error\n\t}\n\n\tlogger.SetOutput(f)\n\n\tlogger.Info(\"My informational message!\")\n\n\tlogger.Debug(\"Debug output for my development process.\")\n\n}\n```\n\nThis uses an output file, customised timestamp format, and setting the format type to `JSON`, rather than plain text output that you would be accustom to in the terminal. Setting the output to `JSON` is more compatible when another program is required to ingest the logs. When using a custom timestamp format, remember that the format should be in the specified Go reference time, otherwise you may see unexpected results.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdockerty%2Fsimplylog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdockerty%2Fsimplylog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdockerty%2Fsimplylog/lists"}