The simple-logger Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The simple-logger Reference Manual

This is the simple-logger Reference Manual, version 1.0.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 15:02:30 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

simple-logger

A simple message logging system.

Overview

This library provides a simple method of defining log messages and later showing them depending on the verbosity level.

Install

(ql:quickload :simple-logger)

Usage

To define a log message, you use DEFINE-MESSAGE, supplying a level, category, and message.

LEVEL Can be one of :TRACE, :DEBUG, :INFO, :WARN, :ERROR, or :FATAL.

CATEGORY A keyword symbol identifier for this message, to be referred to later when you want to emit it.

MESSAGE A string with the message, and any CL:FORMAT directives you want to include.

The global logging level by default is set to :INFO. This means that, unless the value of *CURRENT-LEVEL* is changed, then any messages defined with DEFINE-MESSAGE having a level lower than :INFO will not be displayed when the message is emitted.

To emit a message previously defined with DEFINE-MESSAGE, you use EMIT, giving it the category of the message you want to display, along with any other variables that are consumed by the CL:FORMAT string defined.

Example:

;; Change the global logging level to display messages with a level of :INFO or higher.
(setf *current-level* :info)

;; Define some messages.
(define-message :error :logger.example.error
  "Something bad happened. Arguments: ~{~A~^, ~}")
(define-message :debug :logger.example.hidden
  "This message is not displayed.")

;; Emit the example error message. This will print the following:
;; [ERROR] [2016-12-05 21:14:12] Something bad happened. Arguments: 1, 2, 3
(emit :logger.example.error '(1 2 3))

;; Emit the example debug message. This will not do anything at all because *CURRENT-LEVEL* is
;; higher than :DEBUG.

(emit :logger.example.hidden)

The global message level can be changed at a later time to start displaying messages that would have been hidden.

License

Copyright © 2016-2018 Michael Fiano.

Licensed under the MIT License.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 simple-logger

Maintainer

Michael Fiano <mail@michaelfiano.com>

Author

Michael Fiano <mail@michaelfiano.com>

Home Page

https://www.michaelfiano.com/projects/simple-logger

Source Control

(:git "git@github.com:mfiano/simple-logger.git")

Bug Tracker

https://github.com/mfiano/simple-logger/issues

License

MIT

Description

A simple message logging system.

Long Description

# simple-logger

A simple message logging system.

## Overview

This library provides a simple method of defining log messages and later showing
them depending on the verbosity level.

## Install

“‘ lisp
(ql:quickload :simple-logger)
“‘

## Usage

To define a log message, you use ‘DEFINE-MESSAGE‘, supplying a level, category, and message.

‘LEVEL‘ Can be one of ‘:TRACE‘, ‘:DEBUG‘, ‘:INFO‘, ‘:WARN‘, ‘:ERROR‘, or ‘:FATAL‘.

‘CATEGORY‘ A keyword symbol identifier for this message, to be referred to later when you want to emit it.

‘MESSAGE‘ A string with the message, and any ‘CL:FORMAT‘ directives you want to include.

The global logging level by default is set to ‘:INFO‘. This means that, unless the value of ‘*CURRENT-LEVEL*‘ is changed, then any messages defined with ‘DEFINE-MESSAGE‘ having a level lower than ‘:INFO‘ will not be displayed when the message is emitted.

To emit a message previously defined with ‘DEFINE-MESSAGE‘, you use ‘EMIT‘, giving it the category of the message you want to display, along with any other variables that are consumed by the ‘CL:FORMAT‘ string defined.

Example:

“‘ lisp
;; Change the global logging level to display messages with a level of :INFO or higher.
(setf *current-level* :info)

;; Define some messages.
(define-message :error :logger.example.error
"Something bad happened. Arguments: ~{~A~^, ~}")
(define-message :debug :logger.example.hidden
"This message is not displayed.")

;; Emit the example error message. This will print the following:
;; [ERROR] [2016-12-05 21:14:12] Something bad happened. Arguments: 1, 2, 3
(emit :logger.example.error ’(1 2 3))

;; Emit the example debug message. This will not do anything at all because *CURRENT-LEVEL* is ;; higher than :DEBUG.

(emit :logger.example.hidden)
“‘

The global message level can be changed at a later time to start displaying messages that would have been hidden.

## License

Copyright © 2016-2018 [Michael Fiano](mailto:mail@michaelfiano.com).

Licensed under the MIT License.

Version

1.0.0

Dependencies
Source

simple-logger.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 simple-logger.asd

Location

/home/quickref/quicklisp/dists/quicklisp/software/simple-logger-20180228-git/simple-logger.asd

Systems

simple-logger (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 simple-logger/package.lisp

Parent

simple-logger (system)

Location

package.lisp

Packages

simple-logger


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 simple-logger/logger.lisp

Dependency

package.lisp (file)

Parent

simple-logger (system)

Location

logger.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 simple-logger

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *current-level*

The logging level to use. Can be one of: :TRACE, :DEBUG, :INFO, :WARN, :ERROR, :FATAL

Package

simple-logger

Source

logger.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Macros

Macro: define-message LEVEL NAME MESSAGE

Macro for defining a message to be emitted later.

Package

simple-logger

Source

logger.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Generic functions

Generic Function: emit NAME &rest VARS

Emit the message defined with the given name.

Package

simple-logger

Source

logger.lisp (file)

Methods
Method: emit NAME &rest VARS

Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *log-levels*
Package

simple-logger

Source

logger.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: message-timestamp ()

The current timestamp string formatted for display in a message.

Package

simple-logger

Source

logger.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   S  
Index Entry  Section

F
File, Lisp, simple-logger.asd: The simple-logger․asd file
File, Lisp, simple-logger/logger.lisp: The simple-logger/logger․lisp file
File, Lisp, simple-logger/package.lisp: The simple-logger/package․lisp file

L
Lisp File, simple-logger.asd: The simple-logger․asd file
Lisp File, simple-logger/logger.lisp: The simple-logger/logger․lisp file
Lisp File, simple-logger/package.lisp: The simple-logger/package․lisp file

S
simple-logger.asd: The simple-logger․asd file
simple-logger/logger.lisp: The simple-logger/logger․lisp file
simple-logger/package.lisp: The simple-logger/package․lisp file

Jump to:   F   L   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   D   E   F   G   M  
Index Entry  Section

D
define-message: Exported macros

E
emit: Exported generic functions
emit: Exported generic functions

F
Function, message-timestamp: Internal functions

G
Generic Function, emit: Exported generic functions

M
Macro, define-message: Exported macros
message-timestamp: Internal functions
Method, emit: Exported generic functions

Jump to:   D   E   F   G   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*current-level*: Exported special variables
*log-levels*: Internal special variables

S
Special Variable, *current-level*: Exported special variables
Special Variable, *log-levels*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   S  
Index Entry  Section

P
Package, simple-logger: The simple-logger package

S
simple-logger: The simple-logger system
simple-logger: The simple-logger package
System, simple-logger: The simple-logger system

Jump to:   P   S