1 // Copyright 2017 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <ddk/debug.h>
8 #include <inttypes.h>
9 
10 // Notes: The TRACE and SPEW levels of logging are disabled by default.  In
11 // order to enable them, you can pass something like the following in the kernel
12 // command line args.
13 //
14 //   driver.usb_audio.log=+trace,+spew
15 //
16 constexpr size_t LOG_PREFIX_STORAGE = 32;
17 
18 #define GLOBAL_LOG(level, ...) zxlogf(level, "[USBAud] " __VA_ARGS__)
19 #define LOG_EX(level, obj, fmt, ...) zxlogf(level, "[%s] " fmt, (obj).log_prefix(), ## __VA_ARGS__)
20 #define LOG(level, fmt, ...) LOG_EX(level, *this, fmt, ## __VA_ARGS__)
21