Skip to content

Martini Logger Functions

The Logger class in Martini offers a comprehensive set of functions for logging messages, essential for monitoring and debugging in application development. These functions are compatible with Martini services and Groovy scripts and cover various logging levels to cater to different needs.

Accessing Logger Functions

To utilize Logger functions in Martini: 1. Navigate to the 'Functions' node in your project navigator. 2. Open the 'Logger' folder to view the available logging functions.

Implementing Logger Functions in Services

Logger functions can be integrated into your services using two methods: 1. Drag-and-Drop: Directly drag the desired logging function from the list into your service. 2. Content Assist: Use the content assist feature with the keyword “logger.” followed by the function name to insert it into your service.

Logger Function Usage in Groovy Scripts

Below are examples demonstrating how to use various Logger functions in Groovy scripts:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Debug-level log message
"Conditions matched; proceeding with operation".debug()

// Info-level log message
"Successfully connected to server".info()

// Warning-level log message
"Configuration update failed; reverting to defaults".warn()

// Error-level log message
"Fatal error encountered in task execution".error()

Customizing Logger Names

Martini's Logger functions also allow for the use of custom logger names, offering better log organization. Select a function variant that allows input of both the logger name and the message.