Setting up logging in your code
In simple workflows, users often use the print family of functions to report the state of their programs, for example, for debugging purposes. However, in Julia 1.0, we have built-in functionality enabling diagnostic messages from a program to be handled using custom loggers.
In this recipe, we will explain how you can use loggers to control what is reported by your application. In particular, we will explain how you can add debugging information to your application, yet only enable it on demand.
Getting ready
Now, open your favorite terminal to execute the commands.
Note
In the GitHub repository for this recipe, you will find the commands.txt
file, which contains the presented sequence of shell and Julia commands.
How to do it...
Here is a list of steps to be followed:
- First, load the
Logging
module and then define a function that performs some operations on sets:
julia> using Logging julia> function f(x) y = Set(x) for v in x ...