EzDevInfo.com

XCGLogger

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog or println, but with additional information, such as the date, function name, filename and line number.

How can I get my Swift-based app use XCGLogger with Objective-C?

Currently working on a Swift-based app, I recently added an Objective-C class which I want to use XCGLogger - a swift-based debug logger - with. How can I go about using XCGLogger in this Objective-C class?


Source: (StackOverflow)

Trouble installing XCGLogger swift_2.0

I am trying to install XCGLogger Swift 2.0 using xcode7.4 beta using cocoapods.

Here is my pod file.

platform :ios, '8.0'
use_frameworks!

target 'City Summer School' do
    pod 'Firebase', '>= 2.3.3'
    pod 'XCGLogger', :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :branch => 'swift_2.0'
end

target 'City Summer SchoolTests' do
    pod 'Firebase', '>= 2.3.3'
    pod 'XCGLogger', :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :branch => 'swift_2.0'
end

Yet when I try and compile I get this error.

error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: /Users/nim/Library/Developer/Xcode/DerivedData/City_Summer_School-cwdihbtsferehfbcdcilbmzrnqbp/Build/Products/Debug-iphonesimulator/City Summer School.app/Frameworks/XCGLogger.framework/XCGLogger (No such file or directory)

Have I missed something in the install?

To add additional information

I ran pod install, from the terminal after I configured my Podfile which added to my already existing xcworkspace file.

In the project settings under Linked Frameworks and Libraries?

Pods_City_Summer_School.framework was listed as required.

This is a conversion from Swift 1 --> Swift 2.0


Source: (StackOverflow)

Advertisements

XCGLogger 3.0 doesn't write logfile to filesystem (iOS 9)

I want to use XCGLogger 3.0 to do the logging in an iOS9 app written in Swift 2. In the AppDelegate, I define

let log = XCGLogger.defaultInstance() 

and in application:didFinishLaunchingWithOptions I do the setup with:

log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: "/tmp/app.log", fileLogLevel: .Debug)

When I start the app in the simulator I see the output of XCGLogger in the console of XCode 7. The output is:

2015-11-04 18:28:40.798 [Info] > myapp Version: 1.0 Build: 1 PID: 49243

2015-11-04 18:28:40.798 [Info] > XCGLogger Version: 3.0 - LogLevel: Debug

2015-11-04 18:28:40.801 [Info] > XCGLogger writing to log to: file:///tmp/app.log

But when I look at the sandbox filesystem of the correct simulator instance (using SimPholders2), there is no logfile app.log.

It's even worse when I start the app on my IPhone 6. The output in the XCode console is:

2015-11-04 18:36:14.692 [Error] > Attempt to open log file for writing failed: The operation couldn’t be completed. (Cocoa error 2.)

I also tried different pathes like "/tmp/app.log", "Library/Caches/de.myidentifier.myapp/app.log", "/Library/Caches/de.myidentifier.myapp/app.log" etc. but without success...

What am I doing wrong?


Source: (StackOverflow)

Carthage ld: warning: directory not found for option ' empty search path

im trying to use carthage with a brand new empty project and adding two dependency to Cartfile here how it looks like:

github "RestKit/RestKit" == 0.25.0
github "DaveWoodCom/XCGLogger"

next im going a :

carthage update --platform ios

and get the following error after building a XCGLogger:

ld: warning: directory not found for option '-F/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
ld: warning: directory not found for option '-F/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/Developer/Library/Frameworks'

i've tried to delete and add different search paths with no luck :(


Source: (StackOverflow)

How to install XCGLogger?

I want to add the XCGLogger Framework to my project.

At the XCGLogger github page is a "how to use"-section and a also a demo project. Some tasks are not quite clear for me. Therefore some questions:

  1. "Add the XCGLogger project as a subproject to your project" - Does it mean to simply drag the "Library"-Folder into to my project folder in the project navigator?
  2. "and add either the iOS library as a dependancy of your target(s)" - How am I doing that?
  3. What do I have to do at the Product->Scheme->Edit Scheme ... Menu? Because I don't want the framework in my release build.

Source: (StackOverflow)

use the XCGLogger error XCTest no loading

XCGLogger works in both iOS and OS X projects. It is a Swift library intended for use in Swift projects.

I get the following error:

Cannot load underlying module for "XCTest"

What can be the cause of this error and how can I fix this?


Source: (StackOverflow)

XCGLogger not printing logs out of main classes

I'm writing a little game with SpriteKit using XCGLogger to write logs. The problem is that i can only see logs messages from the GameScene class in the log file, even when I use XCGLogger in other classes like maps, characters, etc.

I defined in appDelegate.swift file the path, log_level and write to tests messages. I used it in GameScene class and in other classes without any header redefinition or other setup. I only copied swift file and header file of XCGLogger library.

I used XCGLogger Version: 1.7 - LogLevel: Debug.

What i'm doing wrong ? It seems that i don't need to use a singleton to share same instance between classes cause log variable created in appDelegate class is a global variable.

Update : Instantiate code : AppDelegate.swift

let log = XCGLogger.defaultInstance()

// Configuración del sistema de Log XCGLogger
            //--------------------------------------------------
            let logPath : NSString = "/Users/memmaker6501/Desktop/CocoaGAME/OctoPussy/log/OctoPus_Log.txt".stringByExpandingTildeInPath
            log.setup(logLevel: .Debug, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: logPath)

            log.verbose("A verbose message, usually useful when working on a specific problem")
            log.debug("A debug message")
            log.info("An info message, probably useful to power users looking in console.app")
            log.error("An error occurred, but it's recoverable, just info about what happened")
            log.severe("A severe error occurred, we are likely about to crash now")

GameScene.swift

Directly using the logging library --> log.debug("Entrada mouseDown")

Using the library in other classes, for example in Map.swift.

log.debug("Entrada generateTileGrid")

Thanks in advance.


Source: (StackOverflow)

Is XCGLogger thread safe?

I am considering using XCGLogger to replace CocoaLumberjack and would like to know if is it permissible to log the following from any thread using a global logger created and setup on the main thread as per the README?

log.info("This is not a valid format: \(inputStr)")

Source: (StackOverflow)

Completely disable logs from XCGLogger when in production

How do I completely disable logs from XCGLogger when in production environment?

At present I am using logLevel = .None.

Is this the recommended way ?


Source: (StackOverflow)

xcglogger via cocoapods results in No Such Module

caveat: new to cocoapods... I have a swift xcode project and I'm trying to use the XCGLogger pod, but after adding it to the podfile, (with use_frameworks! ), pod install -- everything looks good:

enter image description here

but when I put the import XCGLogger in my appdelegate, the compiler tells me No such module: XCGLogger.

import UIKit
import Crashlytics
import XCGLogger

What could I have done wrong (this time:) ?

thanks!


Source: (StackOverflow)

How can I use XCGLogger in a mixed Xcode project (Objective C and Swift)

I have a mixed Xcode project. My appDelegate is written in Objective-C and my Controller partly in Swift. Is it possible to use XCGLogger in that project? If yes, how can I initialized the XCGLogger in the appDelegate (e.g. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions)?


Source: (StackOverflow)