title: How to use iOS OSLog with Xamarin?
body: <p>How can I use the iOS <a href="https://developer.apple.com/documentation/os/oslog" rel="nofollow noreferrer">OSLog</a> in Xamarin.iOS?</p>
  
  <p>I did succeed in using NSLog as follows, but I see no way of setting the subsystem (to the bundle identifier) with NSLog so that I can use that to filter the logs in Console.app.</p>
  
  <pre><code>public class Logger
  {
      #if DEBUG
      [DllImport(ObjCRuntime.Constants.FoundationLibrary)]
      private extern static void NSLog(IntPtr message);
      #endif
  
      public void WriteLine(string line)
      {
          #if DEBUG
          using (var nss = new NSString(line))
          {
              NSLog(nss.Handle);
          }
          #endif
      }
  }
  </code></pre>