"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-5079/ios/sdk/src/JitsiMeetBaseLogHandler.m" (17 Jun 2021, 2567 Bytes) of package /linux/misc/jitsi-meet-5079.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Matlab source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * Copyright @ 2019-present 8x8, Inc.
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  *     http://www.apache.org/licenses/LICENSE-2.0
    9  *
   10  * Unless required by applicable law or agreed to in writing, software
   11  * distributed under the License is distributed on an "AS IS" BASIS,
   12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13  * See the License for the specific language governing permissions and
   14  * limitations under the License.
   15  */
   16 
   17 #import "JitsiMeetBaseLogHandler+Private.h"
   18 
   19 @interface PrivateLogger : DDAbstractLogger <DDLogger>
   20 @end
   21 
   22 @implementation PrivateLogger {
   23     JitsiMeetBaseLogHandler *_delegate;
   24 }
   25 
   26 - (instancetype)initWithDelegate:(JitsiMeetBaseLogHandler *)delegate {
   27     if (self = [super init]) {
   28         _delegate = delegate;
   29     }
   30 
   31     return self;
   32 }
   33 
   34 #pragma mark - DDAbstractLogger interface
   35 
   36 - (void)logMessage:(DDLogMessage *)logMessage {
   37     NSString *logMsg = logMessage.message;
   38     
   39     if (_logFormatter)
   40         logMsg = [_logFormatter formatLogMessage:logMessage];
   41     
   42     if (logMsg && _delegate) {
   43         switch (logMessage.flag) {
   44             case DDLogFlagError:
   45                 [_delegate logError:logMsg];
   46                 break;
   47             case DDLogFlagWarning:
   48                 [_delegate logWarn:logMsg];
   49                 break;
   50             case DDLogFlagInfo:
   51                 [_delegate logInfo:logMsg];
   52                 break;
   53             case DDLogFlagDebug:
   54                 [_delegate logDebug:logMsg];
   55                 break;
   56             case DDLogFlagVerbose:
   57                 [_delegate logVerbose:logMsg];
   58                 break;
   59         }
   60     }
   61 }
   62 
   63 @end
   64 
   65 
   66 @implementation JitsiMeetBaseLogHandler
   67 
   68 #pragma mark - Proxy logger not to expose the CocoaLumberjack headers
   69 
   70 - (instancetype)init {
   71     if (self = [super init]) {
   72         self.logger = [[PrivateLogger alloc] initWithDelegate:self];
   73     }
   74 
   75     return self;
   76 }
   77 
   78 #pragma mark - Public API
   79 
   80 - (void)logVerbose:(NSString *)msg {
   81     // Override me!
   82     [self doesNotRecognizeSelector:_cmd];
   83 }
   84 
   85 - (void)logDebug:(NSString *)msg {
   86     // Override me!
   87     [self doesNotRecognizeSelector:_cmd];
   88 }
   89 
   90 - (void)logInfo:(NSString *)msg {
   91     // Override me!
   92     [self doesNotRecognizeSelector:_cmd];
   93 }
   94 
   95 - (void)logWarn:(NSString *)msg {
   96     // Override me!
   97     [self doesNotRecognizeSelector:_cmd];
   98 }
   99 
  100 - (void)logError:(NSString *)msg {
  101     // Override me!
  102     [self doesNotRecognizeSelector:_cmd];
  103 }
  104 
  105 @end