Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 1.92 KB

README.md

File metadata and controls

63 lines (46 loc) · 1.92 KB

Log

Swift 5.9 Platform SPM

Introduction

Provides a lightweight logging implementation for Swift!

Usage

[STEP 1] Add dependencies

Add this repository's link to Package Dependencies

https://github.com/JYPjoy/Log

[STEP 2] Import packages

import Log

[STEP 3] Basic Usages

Log.t("This is a Trace message.")
Log.d("This is a Debug message.")
Log.i("This is a Informational message.")
Log.n("This is a Notice message.")
Log.w("This is a Warning.")
Log.e("This is a Error.")
Log.c("This is a Critical error.")

Logging Levels

  • You can specify the level of output on initialization. You will see output of that level, and all levels below that.
    Ordered from Least to most Severe.

The order is:

  1. t(TRACE): Appropriate for messages that contain information normally of use only when tracing the execution of a program.
  2. d(DEBUG): Appropriate for messages that contain information normally of use only when debugging a program.
  3. i(INFO): Appropriate for informational messages.
  4. n(NOTICE): Appropriate for conditions that are not error conditions, but that may require special handling.
  5. w(WARNING): Appropriate for messages that are not error conditions, but more severe than .notice
  6. e(ERROR): Appropriate for error conditions.
  7. c(CRITICAL): Appropriate for critical error conditions that usually require immediate attention.

Reference

Swift Official Log Guidelines


License

This library is licensed under MIT license. Full license text is available in LICENSE.