ViewController.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Software License Agreement (BSD License)
  2. //
  3. // Copyright (c) 2010-2025, Deusty, LLC
  4. // All rights reserved.
  5. //
  6. // Redistribution and use of this software in source and binary forms,
  7. // with or without modification, are permitted provided that the following conditions are met:
  8. //
  9. // * Redistributions of source code must retain the above copyright notice,
  10. // this list of conditions and the following disclaimer.
  11. //
  12. // * Neither the name of Deusty nor the names of its contributors may be used
  13. // to endorse or promote products derived from this software without specific
  14. // prior written permission of Deusty, LLC.
  15. #import "ViewController.h"
  16. #import <CocoaLumberjack/CocoaLumberjack.h>
  17. static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
  18. @interface ViewController ()
  19. @end
  20. @implementation ViewController
  21. - (void)viewDidAppear:(BOOL)animated {
  22. [super viewDidAppear:animated];
  23. if (@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)) {
  24. [DDLog addLogger:[DDOSLogger sharedInstance]];
  25. } else {
  26. [DDLog addLogger:(DDTTYLogger *)[DDTTYLogger sharedInstance]];
  27. }
  28. DDLogVerbose(@"Verbose");
  29. DDLogInfo(@"Info");
  30. DDLogWarn(@"Warn");
  31. DDLogError(@"Error");
  32. DDLog *aDDLogInstance = [DDLog new];
  33. if (@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)) {
  34. [aDDLogInstance addLogger:[DDOSLogger sharedInstance]];
  35. } else {
  36. [aDDLogInstance addLogger:(DDTTYLogger *)[DDTTYLogger sharedInstance]];
  37. }
  38. DDLogVerboseToDDLog(aDDLogInstance, @"Verbose from aDDLogInstance");
  39. DDLogInfoToDDLog(aDDLogInstance, @"Info from aDDLogInstance");
  40. DDLogWarnToDDLog(aDDLogInstance, @"Warn from aDDLogInstance");
  41. DDLogErrorToDDLog(aDDLogInstance, @"Error from aDDLogInstance");
  42. }
  43. @end